From e8afe874125d444e137ad5c0664afbbc44af5aff Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 9 Jan 2014 12:36:42 +1100 Subject: [PATCH] BUGFIX: attempt to forward on the protocol set by haproxy --- config/nginx.sample.conf | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/config/nginx.sample.conf b/config/nginx.sample.conf index ebd333df191..0e52d175517 100644 --- a/config/nginx.sample.conf +++ b/config/nginx.sample.conf @@ -37,7 +37,7 @@ server { location / { root $public; - + location ~* \.(eot|ttf|woff)$ { add_header Access-Control-Allow-Origin *; expires 1y; @@ -87,7 +87,14 @@ server { location @discourse { 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 $scheme; + + # attempt to preserve the proto + map $http_x_forwarded_proto $thescheme { + default $scheme; + https https; + } + + proxy_set_header X-Forwarded-Proto $thescheme; proxy_set_header Host $http_host; proxy_pass http://discourse;