部署到 heroku 后 actioncable 不起作用

actioncable does not work after deploy to heroku

我刚刚完成了 learn enough 网站上的动作电缆教程。在开发中一切正常,但在部署到 heroku 后,动作电缆不起作用。我已确保执行以下操作:

(1) cable/yml

adapter: redis
url: <%=ENV['REDISTOGO_URL']%> 

(2) production.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 to go addons

Heroku 日志显示以下错误:

无法升级到 WebSocket(REQUEST_METHOD:GET,HTTP_CONNECTION:升级,HTTP_UPGRADE:websocket)

请求来源不允许:https://myurl.herokuapp.com

我不是刚刚在 production.rb 中指定了允许的请求 url 现在它给出了这个错误吗?

我是 运行 rails 5.0 和 ruby 2.3.1。感谢任何帮助。

我认为:

config.action_cable.allowed_request_origins = [
'https://myurl.herokuapp.com', /http://myurl.herokuapp.com.*/]

应该是这样的:

config.action_cable.allowed_request_origins = [
'https://myurl.herokuapp.com', 'http://myurl.herokuapp.com']