Ingress: use X-Ingress-Path for token redirect w/ trailing slash; bump 0.3.8

This commit is contained in:
root
2026-01-30 02:05:57 +02:00
parent 582e5f367a
commit 9fa6090655
2 changed files with 9 additions and 1 deletions
+8
View File
@@ -37,8 +37,16 @@ http {
# out of ingress (to the HA host root). So we use a *relative* redirect.
# Only redirect the root document to add token in the browser URL.
# NOTE: Home Assistant Ingress can expose the add-on at a path like:
# /hassio/ingress/<slug>
# which may not end in a slash. Some clients compute relative URLs (including WS)
# incorrectly if the URL doesn't end in '/'. HA often provides the original ingress
# path via X-Ingress-Path; if present, redirect to that path with a trailing slash.
location = / {
if ($arg_token = "") {
if ($http_x_ingress_path != "") {
return 302 $http_x_ingress_path/?token=__GATEWAY_TOKEN__;
}
return 302 ?token=__GATEWAY_TOKEN__;
}