September 2022

CORS Blocks Requests for Resources on another Server

If a server doesn't provide a response header with a:

Access-Control-Allow-Origin

that includes the domain you're using or a * wildcard, then you won't be able to access the resource in a browser from another domain.

You can look in the network tab of your browser. For example here's the Headers section for a request showing the Response Headers section. You can see the access-control-allow-origin is set to * which means browser will allow the data to be pulled regardless of what domain your actually on.

A screenshot of the network tab showing the response headers.

You have to either get the server to add an entry for your domain or you have to use a proxy server in order to use the resource.

This is a good, 2min video with an overview:

Kinda a bummer if you're trying to use an API. Alas, that's the way of the thing.

-a

end of line