Skip to content

Commit ddcc29a

Browse files
e9e4e5f0faefJonathan Alvarez Delgado
andauthored
Add cache headers, redirects, et al., from olympia.ini; X-Accel-Redirect sendfile for file serving (#374)
Co-authored-by: Jonathan Alvarez Delgado <jonathan.adl@proton.me>
1 parent dbd122f commit ddcc29a

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

docker/docker-entrypoint.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,16 @@ start_web() {
100100
--log-slow=1000 \
101101
--static-map=/static=/data/olympia/site-static/ \
102102
--static-map=/user-media=${NETAPP_STORAGE_ROOT:-/tmp/storage}/shared_storage/uploads/ \
103+
--static-safe=${NETAPP_STORAGE_ROOT:-/tmp/storage}/shared_storage/uploads/ \
104+
--static-safe=${NETAPP_STORAGE_ROOT:-/tmp/storage}/files/ \
105+
--static-expires=/* 7776000 \
106+
--route-if="equal:\${HTTP_X_FORWARDED_PROTO};http redirect-permanent:https://addons-stage.thunderbird.net\${REQUEST_URI}" \
107+
--route-uri="^/([a-z]{2,3})(-[A-Z]{2,3})?/(firefox|android)/(.*) redirect-302:https://addons.mozilla.org/\$1\$2/\$3/\$4" \
108+
--route-uri="^/user-media/addons/_attachments/(.*) addheader:Content-Disposition: attachment" \
109+
--collect-header="X-Accel-Redirect X_SENDFILE" \
110+
--collect-header="Content-Disposition SENDFILE_CONTENT" \
111+
--response-route-if-not="empty:\${X_SENDFILE} addheader:Content-Disposition:\${SENDFILE_CONTENT}" \
112+
--response-route-if-not="empty:\${X_SENDFILE} static:\${X_SENDFILE}" \
103113
--stats=:9191 \
104114
--stats-http \
105115
"$@"

0 commit comments

Comments
 (0)