diff --git a/cookcli/rootfs/etc/nginx/nginx.conf b/cookcli/rootfs/etc/nginx/nginx.conf index 545ce35..18d3426 100644 --- a/cookcli/rootfs/etc/nginx/nginx.conf +++ b/cookcli/rootfs/etc/nginx/nginx.conf @@ -4,6 +4,9 @@ events { worker_connections 1024; } +# INGRESS_PATH=$(bashio::addon.ingress_entry) +# bashio::log.info "=== ${INGRESS_PATH} ===" + http { include /etc/nginx/mime.types; default_type application/octet-stream; @@ -37,15 +40,17 @@ http { proxy_set_header Connection "upgrade"; proxy_buffering off; + set $ingress_path $http_x_forwarded_prefix; + sub_filter_once off; sub_filter_types text/css application/javascript; - sub_filter 'href="/' 'href="/api/hassio_ingress/8-13u1LdgJuV6yFRcXJAyE7ntZo2W_RHldPJ0xyiiKQ/'; - sub_filter 'src="/' 'src="/api/hassio_ingress/8-13u1LdgJuV6yFRcXJAyE7ntZo2W_RHldPJ0xyiiKQ/'; - sub_filter 'action="/' 'action="/api/hassio_ingress/8-13u1LdgJuV6yFRcXJAyE7ntZo2W_RHldPJ0xyiiKQ/'; + sub_filter 'href="/' 'href="$ingress_path/'; + sub_filter 'src="/' 'src="$ingress_path/'; + sub_filter 'action="/' 'action="$ingress_path/'; # Gérer les redirections - proxy_redirect http://127.0.0.1:9081/ $scheme://$host/api/hassio_ingress/8-13u1LdgJuV6yFRcXJAyE7ntZo2W_RHldPJ0xyiiKQ/; - proxy_redirect http://127.0.0.1:9081 $scheme://$host/api/hassio_ingress/8-13u1LdgJuV6yFRcXJAyE7ntZo2W_RHldPJ0xyiiKQ; + proxy_redirect http://127.0.0.1:9081/ $scheme://$host$ingress_path/; + proxy_redirect http://127.0.0.1:9081 $scheme://$host$ingress_path; } } }