I'm trying to get a Rails 5.0 app with ActionCable deployed on Elastic Beanstalk running Nginx and Puma.
In .ebextensions/nginx.config
I have the following:
location /cable {
proxy_pass http://backend;
proxy_http_version 1.1;
proxy_set_header Upgrade websocket;
proxy_set_header Connection upgrade;
}
and in config/environments/production.rb
config.action_cable.allowed_request_origins = [ 'http://####.####.com', /http:\/\/####.*/ ]
After deploying the app to the Elastic Beanstalk environment I end up with this error in the Chrome console:
WebSocket connection to 'ws://####.####.com/cable' failed: WebSocket is closed before the connection is established.
I've tried following the advice in this thread but end up getting this error instead:
WebSocket connection to 'ws://####.####.com/cable' failed: Error during WebSocket handshake: Unexpected response code: 404
This is what my .ebextensions/nginx.config
file looks like currently.
Any help would be greatly appreciated.