Hello I've looked around and tried a few things and can't get this to work.
I have this fetch request:
index = () => {
return fetch(`${baseUrl}api/deliveries`, {
method: 'GET',
headers: new Headers({
'Access-Control-Allow-Origin': 'http://localhost:3000',
'Content-Type': 'application/json',
}),
})
.then(res => res.json());
}
I get this error in console:
Failed to load http://localhost:8000/api/deliveries: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access. The response had HTTP status code 404. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
Error states 'Access-Control-Allow-Origin'
is not present. But it is. Its there.
Any ideas?