By GeoffreyBog
My droplet : Ruby on Rails 6.0.3.4 on Ubuntu 20.04 | Nginx | Puma | SSL
I’m totally new to ActionCable, and trying to set up Actioncable on my Rails application.
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.
My Nginx
upstream websocket {
server 127.0.0.1:6379;
}
server {
....
location /cable {
proxy_pass https://websocket/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto https;
proxy_redirect off;
}
}
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 :-)
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host;
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.