action cable subscribing locally, but not on heroku

The issue was my host is the heroku app, but the requests were coming from the custom domain.

To solve:

heroku config:set RAILS_HOST "http://www.example.com"

And then in production.rb:

config.action_cable.url = "wss://#{ENV['RAILS_HOST']}/cable"


Your procfile suggests that you run puma with cable/cable.ru on port 28080. Also - file cable/config.ru shouldn't contain this line:

ActionCable.server.config.allowed_request_origins = ["http://localhost:3000"]  

You already configured this in config/environment/*.rb


Is your app name literally app-name? I suspect not. Odds are pretty good that these values...

config.web_socket_server_url = "wss://app-name.herokuapp.com/cable" 
config.action_cable.allowed_request_origins = ['https://app-name.herokuapp.com', 'http://app-name.herokuapp.com']

Need to be updated to use the actual public-facing URL you intend to connect to.