Avoid mixed content

https://github.com/alexbelgium/hassio-addons/issues/405
This commit is contained in:
Alexandre
2022-07-25 10:53:20 +02:00
committed by GitHub
parent 83d353d85c
commit 43462b1bef

View File

@@ -29,6 +29,27 @@ server {
proxy_set_header X-Forwarded-Uri $http_x_ingress_path;
proxy_set_header X-SSL true;
# 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;
# Correct url without port when using https
sub_filter_once off;
sub_filter_types *;
proxy_redirect http://$host/ $x_scheme://$x_host$x_port/;
proxy_redirect $x_scheme://$host/ $x_scheme://$x_host$x_port/;
location / {
allow 172.30.32.2;
deny all;