From 98395392069cbb73d4b36f89b3ee2bdcb66d65ba Mon Sep 17 00:00:00 2001 From: Ruslan Date: Thu, 23 Jul 2026 10:55:42 +0000 Subject: [PATCH] fix: double-check iframe src with HEAD probe before loading After status/ready=true, do HEAD request to the iframe URL itself. If it returns 5xx, keep polling. This prevents Bad Gateway appearing in the iframe when container is technically registered but not yet serving. --- app/main.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/app/main.py b/app/main.py index 777328a..e857f53 100644 --- a/app/main.py +++ b/app/main.py @@ -1679,10 +1679,15 @@ def session_view_page(session_id: str, request: Request, user: User = Depends(re if (r.ok) {{ const data = await r.json(); if (data.ready) {{ - const f = document.getElementById('app-frame'); - f.src = iframeSrc; - f.style.display = ''; - return; + try {{ + const probe = await fetch(iframeSrc, {{method:'HEAD', credentials:'include'}}); + if (probe.status < 500) {{ + const f = document.getElementById('app-frame'); + f.src = iframeSrc; + f.style.display = ''; + return; + }} + }} catch(e) {{}} }} }} }} catch(e) {{}}