Skip to content

fix(console): add CORS headers and OPTIONS preflight to Zen/Go API endpoints#37932

Open
G4brym wants to merge 2 commits into
anomalyco:devfrom
G4brym:fix/zen-cors-preflight
Open

fix(console): add CORS headers and OPTIONS preflight to Zen/Go API endpoints#37932
G4brym wants to merge 2 commits into
anomalyco:devfrom
G4brym:fix/zen-cors-preflight

Conversation

@G4brym

@G4brym G4brym commented Jul 20, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #31041

Type of change

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

What does this PR do?

The Zen/Go API endpoints return 404 on CORS preflight (OPTIONS) requests because only /zen/v1/models and /zen/go/v1/models had OPTIONS handlers. Browser clients were blocked from calling the chat completions, messages, and responses endpoints.

This PR:

  • Adds a shared corsHeaders constant in packages/console/app/src/routes/zen/util/cors.ts.
  • Adds OPTIONS handlers to all Zen/Go inference routes:
    • /zen/v1/chat/completions
    • /zen/v1/messages
    • /zen/v1/responses
    • /zen/v1/models/[model]
    • /zen/go/v1/chat/completions
    • /zen/go/v1/messages
    • /zen/go/v1/responses
  • Adds CORS headers to all POST/streaming/error responses from packages/console/app/src/routes/zen/util/handler.ts.
  • Adds CORS headers to the GET /zen/v1/models and GET /zen/go/v1/models responses.

How did you verify your code works?

  • bun test cors.test.ts in packages/console/app passes (5 tests).
  • bun test in packages/console/app passes (12 tests across all console app test files).
  • bun run typecheck in packages/console/app passes.

Screenshots / recordings

N/A - no UI change.

Checklist

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

@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. and removed needs:compliance This means the issue will auto-close after 2 hours. labels Jul 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Zen API endpoints return 404 on CORS preflight (OPTIONS) — blocks all browser-based clients

1 participant