Skip to content

Bug: Web Terminal & Styles fail to load due to strict CSP (WASM/data: URI blocked) #9420

Closed

Description

@wbe7

Bug Report: Web Terminal & Styles fail to load due to strict CSP

Description:
The opencode web interface is broken in standard browsers because the Content Security Policy (CSP) header sent by the server is too strict. It blocks:

  1. WebAssembly: The ghostty-vt.wasm module (loaded via data: URI) is blocked by connect-src.
  2. Styles: Inline styles are blocked because 'unsafe-inline' is missing from style-src.

Environment:

  • Version: opencode-ai v1.1.25
  • OS: Linux (Ubuntu)
  • Browser: Safari / Chrome (latest)

Steps to Reproduce:

  1. Run opencode web --hostname 0.0.0.0.
  2. Open the web interface in a browser.
  3. Observe broken UI (missing styles) or open the terminal (blank screen).

Error Log (Browser Console):

[Error] Refused to apply a stylesheet because its hash, its nonce, or 'unsafe-inline' appears in neither the style-src directive nor the default-src directive...
[Error] Refused to connect to data:application/wasm... because it does not appear in the connect-src directive...

Required Fix:
The server should send a more permissive CSP for the web interface, explicitly allowing:

  • connect-src data: (for WASM)
  • style-src 'unsafe-inline' (for UI styles)
  • script-src 'unsafe-eval' (if required for WASM glue code)

Temporary Workaround:
We are using an Nginx reverse proxy to strip the original CSP and inject a permissive one.

Activity

  1. github-actions commented on Jan 19, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    Feel free to ignore if these don't address your specific case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

webRelates to opencode on web / desktop

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions