CORS preflight returns 204 but the POST still fails
Frontend on localhost:5173 calling an API on api.example.com. OPTIONS preflight returns 204 with Access-Control-Allow-Origin: * and Access-Control-Allow-Methods: POST, GET. Then the actual POST fails with: Access to fetch at '...' from origin 'http://localhost:5173' has been blocked by CORS policy: Request header field authorization is not allowed by Access-Control-Allow-Headers. I thought Allow-Methods covered it. What do I need to add server side?
4 replies