diff --git a/config/nginx.sample.conf b/config/nginx.sample.conf index 19e645f33..ecf445f1f 100644 --- a/config/nginx.sample.conf +++ b/config/nginx.sample.conf @@ -42,14 +42,6 @@ server { # path to discourse's public directory set $public /var/www/discourse/public; - # prep all possible needed proxy headers - # this is critical form multisite - 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; - - location / { root $public; @@ -83,6 +75,10 @@ server { location ~ /_optimized/ { try_files $uri =404; } # attachments must go through the rails application to get the right content-disposition header + 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-Accel-Mapping $public/=/downloads/; proxy_pass http://discourse; @@ -91,6 +87,10 @@ server { location ~ ^/backups/ { # backups must go through the rails application to handle security + 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-Accel-Mapping $public/=/downloads/; proxy_pass http://discourse; @@ -106,6 +106,10 @@ server { } location @discourse { + 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_pass http://discourse; }