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:
- Using a trait in a model when I had not imported the actually trait into the model
- Had a typo in the model class definition e.g.
class Document implements Filee
instead of File
- I checked the laravel.log and it had an error that I was not implementing some abstract methods in the a certain model class (this was today, toiled for many hours!!!)
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.