I am attempting to perform a simple fetch
to a server I do not control:
fetch('https://path.to.the.server/api/items');
This is a GET endpoint. Using Firefox 52.9.0, if I paste my fetch code into the console and hit Enter, I see the GET request fail in the Network tab with a 401. And in the console, I receive the following errors:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://path.to.the.server/api/items. (Reason: CORS header 'Access-Control-Allow-Origin' missing).
TypeError: NetworkError when attempting to fetch resource.
There's nothing here in this fetch
that should be triggering CORS. Importantly, I do not see a preflight OPTIONS request in the Network tab prior to the 401. The 401 failure is on the GET request itself. However, the errors in the console still point to the browser being denied due to CORS.
So I'm confused why CORS is an issue here. This should be a simple fetch. Is there something I'm missing?
Note: This project is in an "offline" environment, which is why I have not linked the actual URL for community testing.