Fix ingress redirect to keep prefix; bump version 0.3.5
This commit is contained in:
@@ -32,10 +32,14 @@ http {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Gateway UI
|
# Gateway UI
|
||||||
# Ensure the browser URL includes token=... (Clawdbot UI expects it client-side).
|
# IMPORTANT: We must not redirect to an absolute "/..." path because Home Assistant Ingress
|
||||||
location / {
|
# strips the ingress prefix before forwarding to the add-on. An absolute Location would jump
|
||||||
|
# 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.
|
||||||
|
location = / {
|
||||||
if ($arg_token = "") {
|
if ($arg_token = "") {
|
||||||
return 302 $scheme://$host$request_uri?token=__GATEWAY_TOKEN__;
|
return 302 ?token=__GATEWAY_TOKEN__;
|
||||||
}
|
}
|
||||||
|
|
||||||
proxy_pass http://127.0.0.1:18789;
|
proxy_pass http://127.0.0.1:18789;
|
||||||
@@ -47,5 +51,17 @@ http {
|
|||||||
proxy_set_header X-Forwarded-For $remote_addr;
|
proxy_set_header X-Forwarded-For $remote_addr;
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Everything else (assets, ws, etc.) just proxy through.
|
||||||
|
location / {
|
||||||
|
proxy_pass http://127.0.0.1:18789;
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection "upgrade";
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user