【发布时间】:2020-09-04 20:37:22
【问题描述】:
我使用带有 rails 5.1.7 的动作电缆,它在本地的开发环境和生产环境中运行良好,但是当它部署在 aws ec2 上时它无法运行。下面是action cable config的production.rb代码。
config.action_cable.url = 'wss://example.com/cable'
config.action_cable.allowed_request_origins = ["https://example.com", "https://www.example.com"]
config.action_cable.mount_path = '/cable/:token'
ActionCable.server.config.disable_request_forgery_protection = true
下面提到了cable.yml。
development:
adapter: async
test:
adapter: async
production:
adapter: redis
url: redis://localhost:6379/1
但默认安装路径get /cable 不在服务器配置级别调用。如果我正在调用 wss://example.com/cable,那么它正在连接,但默认在页面加载时它没有连接。
【问题讨论】:
标签: ruby-on-rails actioncable ruby-on-rails-5.2 ruby-on-rails-5.1 redis-server