mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-05-26 18:43:39 +02:00
Update ingress.conf
This commit is contained in:
@@ -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/;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user