FIX: multisite uploads broken

This commit is contained in:
Sam 2014-07-14 14:26:25 +10:00
parent b560b11f6e
commit 6a685e822a

View file

@ -75,6 +75,17 @@ server {
} }
location ~ ^/uploads/ { location ~ ^/uploads/ {
# NOTE: it is really annoying that we can't just define headers
# at the top level and inherit.
#
# proxy_set_header DOES NOT inherit, by design, we must repeat it,
# otherwise headers are not set correctly
#
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $thescheme;
proxy_set_header X-Sendfile-Type X-Accel-Redirect; proxy_set_header X-Sendfile-Type X-Accel-Redirect;
proxy_set_header X-Accel-Mapping $public/=/downloads/; proxy_set_header X-Accel-Mapping $public/=/downloads/;
expires 1y; expires 1y;
@ -88,7 +99,7 @@ server {
location ~ /stylesheet-cache/ { location ~ /stylesheet-cache/ {
try_files $uri =404; try_files $uri =404;
} }
# images # this allows us to bypass rails
location ~* \.(gif|png|jpg|jpeg|bmp|tif|tiff)$ { location ~* \.(gif|png|jpg|jpeg|bmp|tif|tiff)$ {
try_files $uri =404; try_files $uri =404;
} }
@ -101,15 +112,21 @@ server {
break; break;
} }
# TODO test in multisite # This big block is needed so we can selectively enable
#location ~ ^/(backups|letter_avatar|user_avatar) { # acceleration for backups and avatars
location ~ ^/backups/ { # see note about repetition above
location ~ ^/(backups|letter_avatar|user_avatar) {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $thescheme;
proxy_set_header X-Sendfile-Type X-Accel-Redirect; proxy_set_header X-Sendfile-Type X-Accel-Redirect;
proxy_set_header X-Accel-Mapping $public/=/downloads/; proxy_set_header X-Accel-Mapping $public/=/downloads/;
proxy_pass http://discourse; proxy_pass http://discourse;
break; break;
} }
# this means every file in public is tried first
try_files $uri @discourse; try_files $uri @discourse;
} }