Meteor Apollo - Setup with Nginx

Need help configuring Meteor Apollo (Cult-of-coders) on an EC2 Server. I get these error in the web console

  • WebSocket connection to ‘ws:/subscriptions’ failed: WebSocket is closed before the connection is established.
  • WebSocket connection to ‘ws://localhost:3050/subscriptions’ failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED

when deploy Meteor app, you will need to define ROOT_URL variable:


I have that set already, its web-socket thats failing presently

after tweaking the nginx config I get the error below (still trying to fix this)

Failed to load http://localhost:3050//graphql: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘’ is therefore not allowed access. The response had HTTP status code 405. If an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled.

@guvcode add cors() middleware to your apollo server: import cors from 'cors'

You are actually correct, I realized later that I had 2 setups and one had ROOT_URL set while the other didn’t, adding that to the ENV variables fixed the issue. Thanks

1 Like