graphql / express-graphql

Create a GraphQL HTTP server with Express.
MIT License
6.34k stars 538 forks source link

graphql apollo client v3 CORS error #751

Closed Loki2 closed 3 years ago

Loki2 commented 3 years ago

Access to fetch at 'http://www.server.api/graphql' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: The 'Access-Control-Allow-Origin' header has a value 'http://192.168.100.25:3000/' that is not equal to the supplied origin. Have the server send the header with a valid value, or, if an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

acao commented 3 years ago

@Loki2 you must configure your express server to accept cross origin requests! The cors module will take care of that. If you have any other issues, the express.js support community can help!