mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-06-04 14:54:07 +02:00
Test
This commit is contained in:
@@ -23,6 +23,31 @@ location /switch-space/ {
|
|||||||
absolute_redirect off;
|
absolute_redirect off;
|
||||||
sub_filter_once off;
|
sub_filter_once off;
|
||||||
sub_filter_types *;
|
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 "/static" "%%ingress_entry%%/static";
|
||||||
sub_filter "/media" "%%ingress_entry%%/media";
|
sub_filter "/media" "%%ingress_entry%%/media";
|
||||||
@@ -75,6 +100,7 @@ location /switch-space/ {
|
|||||||
# Rewrite url
|
# Rewrite url
|
||||||
sub_filter "/static" "%%ingress_entry%%/static";
|
sub_filter "/static" "%%ingress_entry%%/static";
|
||||||
sub_filter "/media" "%%ingress_entry%%/media";
|
sub_filter "/media" "%%ingress_entry%%/media";
|
||||||
|
sub_filter "http://127.0.0.1:8080/" "/";
|
||||||
}
|
}
|
||||||
|
|
||||||
location /media/ {
|
location /media/ {
|
||||||
|
|||||||
Reference in New Issue
Block a user