What is going on
Frontend makes a complex request (POST with JSON body) to API, preflight OPTIONS request fails with 403 or 405 error. Actual request never sent because browser stops at preflight check. Simple GET requests work but POST/PUT/DELETE fail.
CORS configuration exists but doesn't handle preflight requests correctly.
Error messages you might see
Common causes
- OPTIONS method not allowed in CORS configuration
- CORS headers missing or misconfigured: Access-Control-Allow-Methods
- Custom headers not whitelisted: Access-Control-Allow-Headers
- Credentials not allowed: Access-Control-Allow-Credentials missing
- Origin not in allowed list for preflight
How to fix it
Ensure OPTIONS requests are handled and return 200 with CORS headers. Configure: Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS. Access-Control-Allow-Headers: Content-Type, Authorization. Access-Control-Allow-Origin: * (or specific domain). Access-Control-Allow-Credentials: true (only if credentials needed). Test preflight: curl -i -X OPTIONS http://api.example.com/endpoint
Getting help takes about a minute
No hiring, no back and forth. A real person looks at your app.
-
1
Describe it
Tell us what you need in plain words. You don't have to be technical or have an account to start.
-
2
Free 15-minute call
A verified developer calls you. Many tasks are sorted right there, and it costs nothing.
-
3
Pay after you approve
If there is more to do, you get one fixed price up front. You pay only once you are happy.
Real people, reviewed by hand
Developers who do this every day
Every developer is approved by our team before they can take a task. Describe yours and the first one who is free picks it up.
Get helpQuestions
What is CORS preflight?
For non-simple requests (POST with JSON, custom headers), browser sends OPTIONS first to check if request allowed. If OPTIONS fails, actual request never sent.
How to allow all origins?
Access-Control-Allow-Origin: * allows all. For credentials, use specific domain: Access-Control-Allow-Origin: https://example.com
What headers must be allowed?
At minimum: Content-Type. Also: Authorization if using tokens. Declare with: Access-Control-Allow-Headers: Content-Type, Authorization