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, I try to test it by running npm start and it opens up the browser to http://localhost:3000. On one page, I am trying to access my PHP api which is on my shared hosting server. Chrome and Firefox both say that it fails due to server not having Access-Control-Allow-Orgin . Exact Message: Failed to load http://---/api