anomalyco / anomalyco/opencode
Web UI over plain HTTP: sessions appear empty / missing because crypto.subtle and crypto.randomUUID are unavailable on insecure origins
@Hona is already working on this.
Since Sep 1, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Summary
When opencode web is accessed over a plain http:// origin (e.g. http://<vps-ip>:4096 — a very common setup for self-hosted VPS users), multiple parts of the web UI silently fail:
- Image/file attachments silently fail —
crypto.subtleisundefinedon insecure origins, so blob ID / digest generation throws and the attachment is never added to the prompt. No toast, no error, nothing. (Already partially reported in #46419) - Sessions list appears empty or stale — the UI relies on
crypto.randomUUID()/ other crypto APIs in several code paths; on insecure origins these throw, and session listing/switching breaks silently. The user sees "0 sessions" or a fresh state even though sessions exist on the server (verified viaGET /sessionover the API — sessions were there all along).
This is a class of bugs rather than a single issue: any web-platform API gated on secure context breaks when self-hosters access the web UI over http://<ip>, which is the default for anyone running opencode web --hostname 0.0.0.0 on a VPS without a domain/TLS setup.
Steps to reproduce
- On a VPS:
OPENCODE_SERVER_PASSWORD=xxx opencode web --port 4096 --hostname 0.0.0.0 - Open
http://<vps-ip>:4096in Chrome/Firefox from a remote machine - Try attaching an image via
+→ nothing happens, no error - Create a session, refresh — session list may appear empty even though
GET /sessionreturns sessions - Repeat the same over
http://localhost:4096(or via an HTTPS reverse proxy / tunnel) — everything works
Expected
Either:
- Graceful fallbacks (
crypto.getRandomValuesinstead ofcrypto.subtle.digest, Math.random-based UUID fallback) so the web UI fully works on insecure origins, or - A visible warning banner: "You are accessing over an insecure origin; some features (attachments, session management) may not work"
Actual
Silent failure with zero user feedback. Users on VPS deployments think sessions are lost or uploads are broken, and there is no hint that the origin is the problem.
Environment
- opencode 1.18.25 (web UI, Linux VPS)
- accessed via
http://<ip>:4096from a remote desktop browser - workaround verified: putting an HTTPS reverse proxy (Cloudflare tunnel) in front of the server makes everything work
Related
- #46419 (image attachments on insecure origins — same root cause class)
- #46168 (crypto.randomUUID in insecure context)
Thanks!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.