From 3cf2b7c0d144d93a1a20baf856ce6eed8b5c490f Mon Sep 17 00:00:00 2001 From: Marius Robert Macamete Date: Sun, 31 Aug 2025 19:33:15 +0300 Subject: [PATCH] add a map to nginx --- transportmanager/deploy/nginx.conf | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/transportmanager/deploy/nginx.conf b/transportmanager/deploy/nginx.conf index 9d76671..a576b8f 100644 --- a/transportmanager/deploy/nginx.conf +++ b/transportmanager/deploy/nginx.conf @@ -9,6 +9,11 @@ http { access_log /dev/stdout main; error_log /dev/stderr warn; + map $http_x_forwarded_proto $x_proto_pass { + default $http_x_forwarded_proto; + '' $scheme; + } + # Upstreams (internal) upstream api_upstream { server 127.0.0.1:5000; } upstream flet_upstream { server 127.0.0.1:8080; } @@ -21,7 +26,8 @@ http { location /api/ { proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-Proto $x_proto_pass; + proxy_set_header X-Forwarded-Host $host; proxy_pass http://api_upstream/; } @@ -29,7 +35,8 @@ http { location / { proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-Proto $x_proto_pass; + proxy_set_header X-Forwarded-Host $host; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade;