Reputation: 1002
I've already looked at Laravel 5.2 CORS, GET not working with preflight OPTIONS which was helpful to diagnose the issue, but I'm still having issues.
The exact error:
Request header field access-control-allow-origin is not allowed by Access-Control-Allow-Headers in preflight response.
It's no longer failing as a result of the access control response, but it's still failing. How would I go about updating this?
Upvotes: 0
Views: 1121
Reputation: 2566
I have experienced this several times where it gives a CORS error yet if I check, the Access-Control-Allow-Headers it is actually present in the preflight response. I noted that Laravel can sometimes return that CORS because of an issue with the controller/model that is involved with that request. I have experienced this 3 times and these were the 3 reasons:
class Document implements Filee
instead of File
I write this, with examples, in the hope that it can actually help somebody. The issue is difficult to troubleshot given that it just gives a CORS error without much info about what the issue is at the back.
Good luck.
Upvotes: 0
Reputation: 399
Usually this will happen if the route is defined improperly... Check to make sure the route and its verb are properly defined.
Upvotes: 1