I have an actioncable application, on development it works fine, but when and deploy to production on Amazon Web Service. I have this problem
WebSocket connection to 'ws://www.mydomain.com/cable' failed: Invalid frame header
My nginx configuration file
upstream my_app {
server unix:///var/run/puma/my_app.sock;
}
server {
listen 80;
server_name www.mydomain.com;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
root /var/app/current/public;
location / {
try_files $uri @ruby;
}
location @ruby {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://my_app;
}
location /cable {
proxy_pass http://my_app;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
}
}
Cable.yml
development:
adapter: redis
test:
adapter: redis
production:
adapter: redis
url: <%= ENV['REDIS_URL'] %>
enviroments/production.eb
config.action_cable.url = 'ws://www.mydomain.com/cable'
Please if someone can help me