From 9cf23223eb19287b49596994e29d0d072e1b2589 Mon Sep 17 00:00:00 2001 From: Sam Date: Tue, 25 Mar 2014 17:06:15 +1100 Subject: [PATCH] BUGFIX: proxy_set_header is weird in particular no inheritance IF proxy_set_header is specified in child --- config/nginx.sample.conf | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/config/nginx.sample.conf b/config/nginx.sample.conf index 19e645f330d..ecf445f1f6d 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; }