From 2dfc91ac4d6e16c55e42d92f8abd2edd44abbc10 Mon Sep 17 00:00:00 2001 From: kaiyou Date: Mon, 4 Dec 2017 22:19:17 +0100 Subject: [PATCH] Use a map for passing x-forwarded-proto along --- core/nginx/conf/nginx.conf | 6 ++++++ core/nginx/conf/proxy.conf | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/core/nginx/conf/nginx.conf b/core/nginx/conf/nginx.conf index 624e0938..c9bae43d 100644 --- a/core/nginx/conf/nginx.conf +++ b/core/nginx/conf/nginx.conf @@ -20,6 +20,12 @@ http { absolute_redirect off; resolver {{ RESOLVER }} valid=30s; + # Header maps + map $http_x_forwarded_proto $proxy_x_forwarded_proto { + default $http_x_forwarded_proto; + '' $scheme; + } + # Main HTTP server server { # Variables for proxifying diff --git a/core/nginx/conf/proxy.conf b/core/nginx/conf/proxy.conf index c5308a41..f7112c7b 100644 --- a/core/nginx/conf/proxy.conf +++ b/core/nginx/conf/proxy.conf @@ -2,4 +2,4 @@ proxy_set_header Host $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;