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

Closed
opened 2026-02-16 18:16:55 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/6587

State: closed
Merged: Yes


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.

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/6587 **State:** closed **Merged:** Yes --- ## 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.
yindo added the pull-request label 2026-02-16 18:16:55 -05:00
yindo closed this issue 2026-02-16 18:16:55 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#11986