When the preview URL is not a loopback address (e.g. Coder
port-forwarded URLs like https://4000--ws.coder.example.com),
load it directly in the iframe instead of routing through the
subdomain-based proxy which only works for localhost.
This fixes preview for remote-hosted VK (Coder, cloud workspaces)
where users set an override URL to their port-forwarded dev server.
Direct mode is intentionally degraded compared to proxied previews:
no bridge communication, no injected devtools script, no Eruda/inspect
mode, no SPA navigation via postMessage. URL bar navigation triggers
a full iframe reload via setOverrideUrl.
Changes:
- Extract shared LOOPBACK_HOSTS constant (matches usePreviewUrl.ts
and Rust preview-proxy is_loopback_redirect_host)
- iframeUrl: bypass proxy for non-loopback hostnames
- displayedPreviewUrl: strip _refresh param for direct navigation URLs
- handleUrlSubmit: gate bridge SPA navigation on isLoopbackPreview
(devtools script only injected by proxy); non-loopback falls through
to setOverrideUrl for full iframe reload
- Disable Eruda toggle and inspect mode in direct mode (no injected
scripts to handle the commands)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>