From c7a281c78e8cf8d00a66f25554fb01eb9fb314ca Mon Sep 17 00:00:00 2001 From: Luc Date: Tue, 7 Dec 2021 10:57:45 +0100 Subject: [PATCH] keep original proto header if exists --- config/root/etc/nginx/nginx.conf | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/config/root/etc/nginx/nginx.conf b/config/root/etc/nginx/nginx.conf index 0912134..c9ef012 100644 --- a/config/root/etc/nginx/nginx.conf +++ b/config/root/etc/nginx/nginx.conf @@ -44,9 +44,16 @@ http { gzip_http_version 1.1; gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript; + # if x-forwarded-proto header is set to https keep the header + map $http_x_forwarded_proto $real_proto { + default "http"; + "https" "https"; + } + server { listen 4848; listen [::]:4848; + server_name _; root /docs; index index.html; @@ -54,12 +61,10 @@ http { proxy_buffers 32 4k; proxy_set_header Connection ""; - server_name _; - location / { proxy_pass http://127.0.0.1:8080; proxy_set_header Host localhost; - proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-Proto $real_proto; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Real-IP $remote_addr; proxy_redirect off;