我有一个actioncable应用程序,在开发它运行正常,但在Amazon Web Service上部署到生产时。我有这个问题
WebSocket与' ws://www.mydomain.com/cable'失败:框架标题无效
我的nginx配置文件
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'
如果有人可以帮助我