cancel
Showing results for 
Search instead for 
Did you mean: 
My Areas

Sign in or create account

to get a personalized navigation.

andreasn
CONTRIBUTOR ***

CORS errors making requests to API

by andreasn

Hi, I'm trying to request resources from the API using Javascript fetch but are being stopped by CORS errors. If i try to fetch using mode: 'no-cors' I only get a 401 error.

Any ideas on how to solve this?

If my understanding is correct, the API responses should have included an 

Access-Control-Allow-Origin: <mysite>

header, but this does not seem to be the case. Any ides on how to work around this problem? 

1 REPLY 1
andreasn
CONTRIBUTOR ***

by andreasn (Updated ‎25-04-2021 05:23 by andreasn )

I managed to work around this by doing the api fetch directly from my node.js instance, and then fetching from node.js in the browser javascript, but this seems like an unnecessary detour.