Skip to content

Commit 143d78b

Browse files
jrx-codeclaude
andcommitted
fix: v0.20.1 — fix ingress double-slash redirect breaking iframe
The // → / redirect (301) sent the browser to HA root instead of the addon, causing nested HA pages in the ingress panel. Now rewrite the path in-place instead of redirecting. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent a192b44 commit 143d78b

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

ha-sandbox/app/main.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,11 @@ async def ingress_middleware(request: Request, call_next):
7474
"""Support HA ingress by reading X-Ingress-Path header."""
7575
ingress_path = request.headers.get("X-Ingress-Path", "")
7676
request.state.ingress_path = ingress_path
77-
# Normalize double-slash from ingress proxy (GET // → redirect to /)
78-
if request.url.path != "/" and request.url.path.startswith("//"):
79-
return RedirectResponse(request.url.path.replace("//", "/", 1), status_code=301)
77+
# Normalize double-slash from ingress proxy (// → treat as /)
78+
path = request.url.path
79+
if path != "/" and path.startswith("//"):
80+
scope = request.scope
81+
scope["path"] = path.replace("//", "/", 1)
8082
response = await call_next(request)
8183
return response
8284

ha-sandbox/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: "HA Security Sandbox"
2-
version: "0.20.0"
2+
version: "0.20.1"
33
slug: ha_security_sandbox
44
description: "Security scanner for Home Assistant custom components — static analysis + AI review"
55
url: "https://github.com/jrx-code/ha-security-sandbox"

0 commit comments

Comments
 (0)