Skip to content

fix(opencode): allow oc://renderer origin in cors middleware#25099

Merged
Hona merged 1 commit intoanomalyco:devfrom
OpeOginni:fix/oc-server-cors
Apr 30, 2026
Merged

fix(opencode): allow oc://renderer origin in cors middleware#25099
Hona merged 1 commit intoanomalyco:devfrom
OpeOginni:fix/oc-server-cors

Conversation

@OpeOginni
Copy link
Copy Markdown
Contributor

@OpeOginni OpeOginni commented Apr 30, 2026

Issue for this PR

Closes #25075

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

  • Packaged Electron desktop loads the renderer from the privileged oc://renderer scheme, but CORS preflights to the sidecar were returning 404 because the origin wasn't in the hardcoded allowlist.
  • Add oc://renderer next to the existing localhost / tauri:// entries in CorsMiddleware, matching how the effect-httpapi backend already handles it (routes/instance/httpapi/server.ts:116).

Follows the style of the new EFFECT httpapi cors allowlist https://github.com/anomalyco/opencode/blob/dev/packages/opencode/src/server/routes/instance/httpapi/server.ts#L116

How did you verify your code works?

  • bun typecheck in packages/opencode

Screenshots / recordings

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@Hona Hona enabled auto-merge (squash) April 30, 2026 12:00
@Hona Hona merged commit 62e1335 into anomalyco:dev Apr 30, 2026
13 checks passed
@OpeOginni OpeOginni deleted the fix/oc-server-cors branch April 30, 2026 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OpenCode Desktop Beta error: Could not reach Local Server. Retrying automatically...

2 participants