Headers not working
gj1118 opened this issue · comments
Hi, I am doing something like this
let client = graphql("http://localhost:5000/graphql", {
headers: {
"Access-Control-Allow-Origin": "*"
}
})
but I am getting the following error
Access to XMLHttpRequest at 'http://localhost:5000/graphql' from origin 'http://localhost:8080' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Can you please let me know what I am doing wrong here ?
Thanks
Access-Control-Allow-Origin: *
header should be sent by the server not client. That's why your request throws an error.
Thanks , setting it on the server fixed the issue . Much Appreciated.