From 34875577b72ccc362a10d5b59c16b0f674add1cb Mon Sep 17 00:00:00 2001 From: Kenta Suzuki Date: Wed, 26 Sep 2018 18:06:28 +0900 Subject: [PATCH] fix: lookup X-Forwarded-Proto for redirect scheme --- default.conf | 5 +++++ run.sh | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/default.conf b/default.conf index a02eed7..8ac9d3c 100644 --- a/default.conf +++ b/default.conf @@ -1,3 +1,8 @@ +map $http_x_forwarded_proto $redirect_scheme { + default $scheme; + https https; +} + server { listen 80; server_name ${SERVER_NAME}; diff --git a/run.sh b/run.sh index 9bc62dd..844316c 100644 --- a/run.sh +++ b/run.sh @@ -24,7 +24,7 @@ fi # set redirect scheme from optional ENV var if [ ! -n "$SERVER_REDIRECT_SCHEME" ] ; then - SERVER_REDIRECT_SCHEME='$scheme' + SERVER_REDIRECT_SCHEME='$redirect_scheme' fi # set access log location from optional ENV var