This commit is contained in:
Alexandre
2022-12-20 16:49:01 +01:00
committed by GitHub
parent 7d5a54f577
commit 25e0e5b1b3

View File

@@ -23,6 +23,31 @@ location /switch-space/ {
absolute_redirect off;
sub_filter_once off;
sub_filter_types *;
# avoid mixed content
# Ensure work with both http and https (code by @met67)
if ($http_referer ~* "^(http[s]?)://([^:]+):(\d*)(/.*)$") {
set $x_scheme $1;
set $x_host $2;
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_set_header X-Host $x_host;
proxy_set_header X-Port $x_port;
proxy_set_header X-Forwarded-Proto $x_scheme;
proxy_set_header Host $x_host$x_port; # Required for addresses without ports
# Correct url without port when using https
sub_filter_once off;
sub_filter_types *;
sub_filter https://$x_host/ https://$x_host$x_port/;
sub_filter http://$x_host/ http://$x_host$x_port/;
sub_filter "/static" "%%ingress_entry%%/static";
sub_filter "/media" "%%ingress_entry%%/media";
@@ -75,6 +100,7 @@ location /switch-space/ {
# Rewrite url
sub_filter "/static" "%%ingress_entry%%/static";
sub_filter "/media" "%%ingress_entry%%/media";
sub_filter "http://127.0.0.1:8080/" "/";
}
location /media/ {