Skip to content

Add CORS headers to API routes#152

Open
niran wants to merge 2 commits intomasterfrom
niran/cors-headers
Open

Add CORS headers to API routes#152
niran wants to merge 2 commits intomasterfrom
niran/cors-headers

Conversation

@niran
Copy link
Contributor

@niran niran commented Mar 15, 2026

Summary

  • Add a Next.js proxy (src/proxy.ts) that sets Access-Control-Allow-Origin: * on all /api/* responses
  • Handles OPTIONS preflight requests with 204
  • Uses the Next.js 16 proxy file convention (replacement for deprecated middleware)

Test plan

  • Verified locally: OPTIONS /api/health returns 204 with CORS headers
  • Verified locally: GET /api/health returns 200 with CORS headers
  • No deprecation warning from Next.js

niran added 2 commits March 15, 2026 12:35
Allow cross-origin requests to /api/* endpoints by adding a Next.js
proxy (the v16 replacement for middleware) that sets
Access-Control-Allow-Origin: * on all API responses and handles
OPTIONS preflight requests.
@niran niran requested a review from wlawt March 16, 2026 17:20
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.

1 participant