Skip to content

fix(server): add Content-Type headers for proxied static assets#6587

Merged
adamdotdevin merged 1 commit into
anomalyco:devfrom
monotykamary:fix/proxy-mime-types
Jan 1, 2026
Merged

fix(server): add Content-Type headers for proxied static assets#6587
adamdotdevin merged 1 commit into
anomalyco:devfrom
monotykamary:fix/proxy-mime-types

Conversation

@monotykamary

Copy link
Copy Markdown
Contributor

Summary

  • Fixes MIME type errors when loading the web interface via opencode web
  • Adds automatic Content-Type header detection based on file extension when proxying responses from app.opencode.ai

Problem

When running opencode web, the browser console shows:

Failed to load module script: Expected a JavaScript-or-Wasm module script but the server responded with a MIME type of "". Strict MIME type checking is enforced for module scripts per HTML spec.

This happens because Cloudflare doesn't return Content-Type headers for static assets served from app.opencode.ai.

Solution

The proxy handler now detects file extensions (.js, .css, .wasm, etc.) and adds the appropriate Content-Type header to the response before returning it to the browser.

Cloudflare doesn't return Content-Type headers for static assets served
from app.opencode.ai, causing browsers to reject module scripts with
MIME type errors. This adds automatic Content-Type detection based on
file extension when proxying responses.
@monotykamary

Copy link
Copy Markdown
Contributor Author

even though i'm a TUI guy, we gotta save the web @adamdotdevin @rekram1-node

@adamdotdevin adamdotdevin merged commit dc85863 into anomalyco:dev Jan 1, 2026
2 checks passed
triklozoid pushed a commit to triklozoid/opencode that referenced this pull request Feb 2, 2026
xywsxp pushed a commit to xywsxp/opencode that referenced this pull request Apr 24, 2026
Rwanbt pushed a commit to Rwanbt/opencode that referenced this pull request May 5, 2026
AIALRA-0 pushed a commit to AIALRA-0/opencode-turn-engine that referenced this pull request Jun 10, 2026
AIALRA-0 pushed a commit to AIALRA-0/opencode-turn-engine that referenced this pull request Jun 10, 2026
avion23 pushed a commit to avion23/opencode that referenced this pull request Jun 10, 2026
Rwanbt pushed a commit to Rwanbt/opencode that referenced this pull request Jun 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants