Update ingress.conf

This commit is contained in:
Alexandre
2022-08-27 23:36:02 +02:00
committed by GitHub
parent eb3efd59dd
commit b044107667

View File

@@ -30,5 +30,27 @@ server {
add_header X-Frame-Options SAMEORIGIN;
add_header Access-Control-Allow-Origin *;
proxy_set_header Accept-Encoding "";
# 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-Forwarded-Proto $x_scheme;
# Correct url without port when using https
sub_filter_once off;
sub_filter_types *;
sub_filter https://$host/ $x_scheme://$host$x_port/;
sub_filter http://$host/ $x_scheme://$host$x_port/;
}
}