ActionCable + Heroku + Custom Domain

My last blog post I discuss how I set up realtime chatting with the new Rails5 ActionCable.

Then I went to launch on heroku — worked perfectly.

Then I pushed to a heroku app with a custom domain name, let’s call it . It didn’t seeing anything subscribing on the custom domain, but if I went to the herokuapp URL, I could see it subscribing the user.

The problem is that the server is still listening on:

I searched for days and days for a way to allow the server to listen to the custom URL’s connection, and after it all… it was just a couple simple lines:

heroku config:set RAILS_HOST ""

And in production.rb

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

I hope this helps anyone else who is working with ActionCable on a Heroku custom domain, or white-labeled URL!



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s