You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Web UI: Basic Auth incompatible with crossorigin attributes on assets #9206
When using OPENCODE_SERVER_PASSWORD to protect the web UI, users get stuck in an authentication loop. The page loads after entering credentials, but assets (JS/CSS) fail to load with 401 Unauthorized.
Root Cause
The HTML page includes assets with crossorigin attribute:
When crossorigin is used withoutcrossorigin="use-credentials", browsers make anonymous CORS requests that don't include HTTP Basic Auth credentials. This causes:
Browser loads main HTML page with auth ✅
Browser requests JS/CSS with crossorigin (anonymous) → 401 Unauthorized ❌
Auth popup appears again for each failed asset
Infinite loop - even re-entering credentials doesn't fix it
Environment
OpenCode version: 1.1.16
Access method: Cloudflare tunnel (remote access)
Browser: Chrome/Firefox (both affected)
Steps to Reproduce
Start OpenCode web with password:
OPENCODE_SERVER_PASSWORD=secret opencode web --port 4096
Access via browser (especially through reverse proxy/tunnel)
Enter username opencode and password secret
Observe: Page appears but is blank/broken, repeated auth prompts appear
Expected Behavior
After successful authentication, all assets should load without additional auth prompts.
Switch to cookie-based authentication instead of HTTP Basic Auth for web access
Exempt static assets from authentication (JS, CSS, images, fonts)
Workaround
Currently, users must run without OPENCODE_SERVER_PASSWORD when accessing via tunnels/proxies, relying on the obscurity of the tunnel URL for security.
Thank you for the great project! Happy to provide more details or test fixes.
Activity
github-actions commentedon Jan 18, 2026
This issue might be a duplicate of existing issues. Please check:
Feel free to ignore if none of these address your specific case.
github-actions commentedon Mar 27, 2026
To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.