Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ios Safari XMLHttpRequest cannot load due to access control checks

I am trying to do a POST request with some multipart data, it works perfectly on every other browser and device that I have checked but on iOS Safari it does not work and gives these 3 errors:

Origin [URL HERE] is not allowed by Access-Control-Allow-Origin.
Failed to load resource: Origin [URL HERE] is not allowed by Access-Control-Allow-Origin.
XMLHttpRequest cannot load [URL HERE] due to access control checks.

On my server, I believe I have setup cors correctly.

BTW, I am using the iOS Simulator and it does work on MacOS Safari

Any ideas?

like image 513
Danny Avatar asked Jun 02 '18 19:06

Danny


1 Answers

Do you have a mix of http/https traffic such as your webapp being hosted in https, but your POST going to an http server? Unfortunately Safari doesn't give great error messaging if this is what's happening. I'd check with curl to see if the url that you're requesting from returns the data and headers that you expect.

like image 155
KFunk Avatar answered Sep 18 '22 11:09

KFunk