CORS doesn't work with `DependsOnMethod`
See original GitHub issueI was trying express-zod-api
and found errors with CORS.
For request with methods different of GET and POST, it looks like the CORS middleware doesn’t exits, similar to #514
Reproduction repository https://github.com/leosuncin/express-zod-api-cors-error
Issue Analytics
- State:
- Created 10 months ago
- Comments:10 (7 by maintainers)
Top Results From Across the Web
3 Ways to Fix the CORS Error — and How the Access-Control ...
Fix one: install the Allow-Control-Allow-Origin plugin. The quickest fix you can make is to install the moesif CORS extension .
Read more >CORS doesn't work despite headers set - Stack Overflow
I have an app where the client makes a multipart request from example.com to api.example.com through https with Nginx, then api uploads the...
Read more >Troubleshoot CORS errors from API Gateway - AWS
Cross-Origin Resource Sharing (CORS) errors occur when a server doesn't return the HTTP headers required by the CORS standard.
Read more >Fixing Common Problems with CORS and JavaScript
Tutorial: This post walks through troubleshooting and fixing common problems associated with calling REST APIs from JavaScript.
Read more >Automated Test Case fails due "Access ... has been blocked ...
Access to XMLHTttpRequest at … (redirected from …) from origin … has been blocked by CORS policy: Response to preflight request doesn't pass ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The
OPTIONS
requestThe
PUT
requestBoth works in the terminal, but not in the browser
Download CORS_error.zip, unzip it and upload the HAR file to https://toolbox.googleapps.com/apps/har_analyzer/
The issue with allowed methods is fixed in recently released v8.4.1 🚀 Thank you again for finding this, @leosuncin I’m also going to fix it in v7.
It should work in your repo now, but without authorization. In order to allow
Authorization
header, consider changingcors
config option into a function. See the example above.