Update ingress.conf

This commit is contained in:
Alexandre
2022-08-27 23:38:03 +02:00
committed by GitHub
parent b044107667
commit 669c90a02d

View File

@@ -13,7 +13,6 @@ server {
proxy_set_header Connection "Upgrade"; proxy_set_header Connection "Upgrade";
proxy_set_header Upgrade $http_upgrade; proxy_set_header Upgrade $http_upgrade;
proxy_set_header Host $http_host; # try $host instead if this doesn't work proxy_set_header Host $http_host; # try $host instead if this doesn't work
proxy_set_header X-Forwarded-Proto $scheme; # http or https
# Allow ingress subpath # Allow ingress subpath
proxy_set_header X-Script-Name %%ingress_entry%%; proxy_set_header X-Script-Name %%ingress_entry%%;
@@ -31,26 +30,26 @@ server {
add_header Access-Control-Allow-Origin *; add_header Access-Control-Allow-Origin *;
proxy_set_header Accept-Encoding ""; proxy_set_header Accept-Encoding "";
# avoid mixed content # avoid mixed content
# Ensure work with both http and https (code by @met67) # Ensure work with both http and https (code by @met67)
if ($http_referer ~* "^(http[s]?)://([^:]+):(\d*)(/.*)$") { if ($http_referer ~* "^(http[s]?)://([^:]+):(\d*)(/.*)$") {
set $x_scheme $1; set $x_scheme $1;
set $x_host $2; set $x_host $2;
set $x_port ":$3"; set $x_port ":$3";
} }
# Ensure works if standard port (code by @met67) # Ensure works if standard port (code by @met67)
if ($http_referer ~* "^(http[s]?)://([^:]+)(/.*)$") { if ($http_referer ~* "^(http[s]?)://([^:]+)(/.*)$") {
set $x_scheme $1; set $x_scheme $1;
set $x_host $2; set $x_host $2;
set $x_port ""; set $x_port "";
} }
proxy_set_header X-Scheme $x_scheme; proxy_set_header X-Scheme $x_scheme;
proxy_set_header X-Forwarded-Proto $x_scheme; proxy_set_header X-Forwarded-Proto $x_scheme;
# Correct url without port when using https # Correct url without port when using https
sub_filter_once off; sub_filter_once off;
sub_filter_types *; sub_filter_types *;
sub_filter https://$host/ $x_scheme://$host$x_port/; sub_filter https://$host/ $x_scheme://$host$x_port/;
sub_filter http://$host/ $x_scheme://$host$x_port/; sub_filter http://$host/ $x_scheme://$host$x_port/;
} }
} }