Adrian Adrian - 4 months ago 45
Ruby Question

actioncable does not work after deploy to heroku

I have just completed the action cable tutorial from the learn enough site. Everything is working fine in development but after deploying to heroku the action cables don't work. I have made sure to do the following:

(1) cable/yml

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

(2) production.rb

config.action_cable.url = 'wss://'
config.action_cable.allowed_request_origins = [
'', /*/]

(3) routes -

mount ActionCable.server, at: '/cable'

(4) added the redis to go addons in heroku

Heroku logs shows the following errors:

Failed to upgrade to WebSocket (REQUEST_METHOD: GET, HTTP_CONNECTION: Upgrade, HTTP_UPGRADE: websocket)

Request origin not allowed:

Didn't i just specify the allowed request url in production.rb and now its giving this error?

I am running rails 5.0 and ruby 2.3.1. Appreciate any assistance.


I think this:

config.action_cable.allowed_request_origins = [
'', /*/]

should be this:

config.action_cable.allowed_request_origins = [
'', '']