Skip to content

Commit 8b5a0b3

Browse files
committed
feat(router): set additional X-Forwarded headers
Set X-Forwarded headers to enable apps to more accurately detect environment
1 parent 9f658ab commit 8b5a0b3

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

router/image/templates/nginx.conf

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,16 @@ http {
157157
{{ if eq $useFirewall "true" }}include /opt/nginx/firewall/active-mode.rules;{{ end }}
158158
proxy_buffering off;
159159
proxy_set_header Host $host;
160-
{{ if ne $useSSL "false" }}
161-
proxy_set_header X-Forwarded-Proto $scheme;
162-
{{ end }}
160+
set $access_ssl 'off';
161+
set $access_port '80';
162+
if ($access_scheme ~ https) {
163+
set $access_ssl 'on';
164+
set $access_port '443';
165+
}
166+
proxy_set_header X-Forwarded-Port $access_port;
167+
proxy_set_header X-Forwarded-Proto $access_scheme;
163168
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
169+
proxy_set_header X-Forwarded-Ssl $access_ssl;
164170
proxy_redirect off;
165171
proxy_connect_timeout 30s;
166172
proxy_send_timeout 1200s;

0 commit comments

Comments
 (0)