From 199f18da07141990bbaa5042c7c3053f000d2846 Mon Sep 17 00:00:00 2001 From: Mike Dillon Date: Wed, 22 Oct 2014 15:18:46 -0700 Subject: [PATCH] Pass through X-Forwarded-Proto * Creates a $proxy_x_forwarded_proto variable that is set to the X-Forwarded-Proto header passed by the client or else the $scheme --- nginx.tmpl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/nginx.tmpl b/nginx.tmpl index c50eb0b..f0cae0d 100644 --- a/nginx.tmpl +++ b/nginx.tmpl @@ -1,3 +1,8 @@ +map $http_x_forwarded_proto $proxy_x_forwarded_proto { + default $http_x_forwarded_proto; + '' $scheme; +} + server { listen 80 default_server; server_name _; # This is just an invalid value which will never trigger on a real hostname. @@ -53,7 +58,7 @@ server { 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 $scheme; + proxy_set_header X-Forwarded-Proto $proxy_x_forwarded_proto; # HTTP 1.1 support proxy_http_version 1.1;