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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.