I'm totally new to ActionCable... Trying to set up Action cable on a Rails 6.0 application (Nginx + Puma). I also have to say my environment is on the cloud (DigitalOcean.com), and that is SSL.
My config/cable.yml :
development:
adapter: redis
url: redis://localhost:6379
My config/environments/development.rb : i've just added this lines
config.action_cable.allowed_request_origins = ["https://my.url.com/"]
config.action_cable.url = "ws://localhost:3000/cable"
Of course: my.url.com is my domain.
I'm getting this error :
WebSocket connection to 'wss://my.url.com/cable' failed: WebSocket is closed before the connection is established.
Does anyone have a idea ?
Thanks a lot :-)
Add a location block to your nginx configuration file.
location /cable {
proxy_pass http://puma_app;
proxy_http_version 1.1;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-Ssl on;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
Replace puma_app
with your upstream name.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With