From 43e2d1d0739ebed8a4865672c8c91c0408ec67ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Cap=C3=B3?= Date: Sat, 22 Jun 2024 19:15:43 +0200 Subject: [PATCH] propagate X-Forwarded-Proto header --- docker/rootfs/etc/nginx/conf.d/include/proxy.conf | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/docker/rootfs/etc/nginx/conf.d/include/proxy.conf b/docker/rootfs/etc/nginx/conf.d/include/proxy.conf index d346c4ef..7fa1da31 100644 --- a/docker/rootfs/etc/nginx/conf.d/include/proxy.conf +++ b/docker/rootfs/etc/nginx/conf.d/include/proxy.conf @@ -1,7 +1,13 @@ add_header X-Served-By $host; proxy_set_header Host $host; -proxy_set_header X-Forwarded-Scheme $scheme; -proxy_set_header X-Forwarded-Proto $scheme; + +set $origin_scheme $scheme; +if ($http_x_forwarded_proto != "") { + set $origin_scheme $http_x_forwarded_proto; +} +proxy_set_header X-Forwarded-Scheme $origin_scheme; +proxy_set_header X-Forwarded-Proto $origin_scheme; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Real-IP $remote_addr; proxy_pass $forward_scheme://$server:$port$request_uri;