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.
This commit is contained in:
+9
-4
@@ -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) {{}}
|
||||
|
||||
Reference in New Issue
Block a user