Closed C-3-F closed 8 months ago
@C-3-F Thank you for sharing! Taking a look
@samcx just to confirm - this hasn't been addressed yet has it?
@tomelliot Looks like this slipped! Taking a look again
Resolved by https://github.com/vercel/next.js/pull/63264
Thanks @samcx !
This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.
Link to the code that reproduces this issue
https://github.com/C-3-F/nextjs13-cors-bug-example
To Reproduce
Start both the client and server by using the above commands.
In the request payload box, type some sample JSON. The requests will just take that request and return it.
The 'works' box will return the payload with a 200.
The 'doesntwork' box will fail the request with a CORS error.
Current vs. Expected behavior
The expected behavior is that Global CORS headers set in next-config.js should be applied to all request method types.
Current behavior is that if you have a POST method alone, the CORS headers are not set. If you add a GET method to the same route, then the POST request magically works.
Verify canary release
Provide environment information
Which area(s) are affected? (Select all that apply)
App Router, Middleware / Edge (API routes, runtime)
Additional context
I'm pretty sure this issue was introduced with the App router. I haven't been able to get it to work with any versions ^13.4. I'm also using the Brave browser. But also tested in Chrome which is broken too.
NEXT-2810