Fix nginx config: replace nested if with map for X-Ingress-Path redirect; bump 0.3.9
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
name: Moltbot Assistant
|
name: Moltbot Assistant
|
||||||
version: "0.3.8"
|
version: "0.3.9"
|
||||||
slug: moltbot_assistant
|
slug: moltbot_assistant
|
||||||
description: Run Moltbot Assistant (Clawdbot-compatible) as a Home Assistant add-on.
|
description: Run Moltbot Assistant (Clawdbot-compatible) as a Home Assistant add-on.
|
||||||
url: https://github.com/techartdev/ClawdHAAddOn
|
url: https://github.com/techartdev/ClawdHAAddOn
|
||||||
|
|||||||
@@ -16,6 +16,15 @@ http {
|
|||||||
sendfile on;
|
sendfile on;
|
||||||
keepalive_timeout 65;
|
keepalive_timeout 65;
|
||||||
|
|
||||||
|
# Home Assistant Ingress may pass the original ingress path in X-Ingress-Path.
|
||||||
|
# If present, use it to build a redirect that keeps the browser under ingress
|
||||||
|
# and ensures a trailing slash before the query string.
|
||||||
|
map $http_x_ingress_path $token_redirect {
|
||||||
|
default "?token=__GATEWAY_TOKEN__";
|
||||||
|
"" "?token=__GATEWAY_TOKEN__";
|
||||||
|
~.+ "$http_x_ingress_path/?token=__GATEWAY_TOKEN__";
|
||||||
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 8099;
|
listen 8099;
|
||||||
|
|
||||||
@@ -44,10 +53,7 @@ http {
|
|||||||
# path via X-Ingress-Path; if present, redirect to that path with a trailing slash.
|
# path via X-Ingress-Path; if present, redirect to that path with a trailing slash.
|
||||||
location = / {
|
location = / {
|
||||||
if ($arg_token = "") {
|
if ($arg_token = "") {
|
||||||
if ($http_x_ingress_path != "") {
|
return 302 $token_redirect;
|
||||||
return 302 $http_x_ingress_path/?token=__GATEWAY_TOKEN__;
|
|
||||||
}
|
|
||||||
return 302 ?token=__GATEWAY_TOKEN__;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
proxy_pass http://127.0.0.1:18789;
|
proxy_pass http://127.0.0.1:18789;
|
||||||
|
|||||||
Reference in New Issue
Block a user