【发布时间】:2017-04-09 09:20:54
【问题描述】:
我刚刚完成了足够学习网站上的动作电缆教程。开发中一切正常,但在部署到 heroku 后,动作电缆不起作用。我已确保执行以下操作:
(1) 电缆/yml
adapter: redis
url: <%=ENV['REDISTOGO_URL']%>
(2) 生产.rb
config.action_cable.url = 'wss://myurl.herokuapp.com/cable'
config.action_cable.allowed_request_origins = [
'https://myurl.herokuapp.com', /http://myurl.herokuapp.com.*/]
(3) 条路线 -
mount ActionCable.server, at: '/cable'
(4) 在heroku中添加redis到go插件
Heroku 日志显示以下错误:
升级到 WebSocket 失败(REQUEST_METHOD: GET, HTTP_CONNECTION: Upgrade, HTTP_UPGRADE: websocket)
请求来源不允许:https://myurl.herokuapp.com
我不是只是在 production.rb 中指定了允许的请求 url,现在它给出了这个错误吗?
我正在运行 rails 5.0 和 ruby 2.3.1。感谢任何帮助。
【问题讨论】:
标签: ruby heroku actioncable