Allows standard ports

https://github.com/alexbelgium/hassio-addons/issues/345
This commit is contained in:
Alexandre
2022-06-08 22:15:14 +02:00
committed by GitHub
parent 6cfddb2fdb
commit 1e195220ac

View File

@@ -24,11 +24,18 @@ server {
if ($http_referer ~* "^(http[s]?)://([^:]+):(\d*)(/.*)$") {
set $x_scheme $1;
set $x_host $2;
set $x_port $3;
set $x_port ":$3";
}
# Ensure works if standard port (code by @met67)
if ($http_referer ~* "^(http[s]?)://([^:]+)(/.*)$") {
set $x_scheme $1;
set $x_host $2;
set $x_port "";
}
proxy_set_header X-Scheme $x_scheme;
proxy_redirect http://$host/ $x_scheme://$x_host:$x_port/;
proxy_redirect https://$host/ $x_scheme://$x_host:$x_port/;
proxy_redirect http://$host/ $x_scheme://$x_host$x_port/;
proxy_redirect $x_scheme://$host/ $x_scheme://$x_host$x_port/;
}
}