Cannot GET gist. No Access-Control-Allow-Origin header


I’m trying to get a Gist by GETting the .json url. When I do, I get an Network Error like this:

Failed to load No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:9999' is therefore not allowed access.

I’m calling the API using axios in the browser.

The Access-Control-Allow-Origin header is a response header as I understand it. So I’m stumped as to how to resolve this. I know this is a CORS issue. But I thought adding the Origin header would resolve it.

How can I get this to work properly?



I figured this out by using jsonp. Wish the docs were better on this. I did eventually get it though.