In the pipeline section, each environment has a handy “Open app” button, but this simply opens a tab with the
herokuapp.com URL, so it’s not exactly useful for folks who have a custom domain for their app. Instead of blindly accepting this reality and continuing to lie to myself that there’s nothing I can do, I realized I could simply add a redirect:
get '/', host_name: /^[\w-]+\.herokuapp\.com/ do redirect 'https://mycoolapp.biz' end
This works if you like to hard-code things, but Cushion also has a staging environment at a different, top secret URL, so I can’t (and shouldn’t) hard-code the redirect URL and call it a day. Instead, I can use an environment variable to change the app URL between environments:
get '/', host_name: /^[\w-]+\.herokuapp\.com/ do redirect ENV['APP_URL'] end
Now, when I click the “Open app” button on either the staging app or the production app in Heroku’s pipeline panel, I end up where I expected I’d be. Such an obvious solution, but I simply never took the time to make the change. In an ideal world, Heroku would have a setting to route that button to the custom domain you already have listed in your settings, but we can’t have everything.