Cross origin error thrown on GraphQL subscription

1k views Asked by At

I'm setting up GraphQL subscription as per this tutorial: https://hasura.io/docs/1.0/graphql/core/guides/integrations/apollo-subscriptions.html

I'm getting CORS error and all my requests to web sockets are failed. How can I resolve it?

1

There are 1 answers

2
Noah Kanyo On BEST ANSWER

Hasura uses a special way for dealing with CORS, depending on which environment you are using. If you are using heroku, in your env variables you need to add Hasura specific variables to enable CORS.

HASURA_GRAPHQL_CORS_DOMAIN="https://*.foo.bar.com:8080, http://*.localhost, http://localhost:3000, http://example.com"

Check out the CORS configuration example