Skip to content Skip to sidebar Skip to footer

Request Fails Due To Cors Issue With Origin From Localhost

I have seen dozens of questions on SO and different blogs talking about this with 'answers' -- all to no avail. I have a React.js app on my local machine (Ubuntu 16.04). Locally,

Solution 1:

I'm an idiot.

Origin was misspelled as Orgin.

This typo has existed in my project for almost three years. This was the first time I needed to use cross-domain access.

Solution 2:

header("Access-Control-Allow-Methods: *");

Should be:

header("Access-Control-Allow-Methods: GET, POST, HEAD, OPTIONS, PUT, DELETE, PATCH");

...and any other methods you intend to accept.

Post a Comment for "Request Fails Due To Cors Issue With Origin From Localhost"