I’m trying to get and post data using an API. Before moving live I’m trying to debug this on my local server and I’m getting CORS errors. I’ve tried many different request headers, browser plugins and etc. In general, it seems reasonable - API storage does not handle requests from the wrong domains. But why does when I curl
and try to GET - it works? Thanks
You need to set Origin
in request header to simulate browser cross origin request:
curl -H "Origin: http://example.com" --verbose \
https://api.target-website.com/foo