mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-08-10 07:02:29 +02:00
Avoid mixed content
https://github.com/alexbelgium/hassio-addons/issues/405
This commit is contained in:
@@ -29,6 +29,27 @@ server {
|
|||||||
proxy_set_header X-Forwarded-Uri $http_x_ingress_path;
|
proxy_set_header X-Forwarded-Uri $http_x_ingress_path;
|
||||||
proxy_set_header X-SSL true;
|
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 / {
|
location / {
|
||||||
allow 172.30.32.2;
|
allow 172.30.32.2;
|
||||||
deny all;
|
deny all;
|
||||||
|
|||||||
Reference in New Issue
Block a user