I am running a multi tenant app that uses subdomains for tenants on Heroku. In production I have a domain where subdomains point to my heroku app. (This all works fine)
For staging, I'd like to test without creating another domain. Since my app uses the first subdomain it sees to find the current tenant, I was hoping to use a url like: tenant.myapp.herokuapp.com. However, this is not working (heroku returns a 'no such app' error.)
I've found this post from 2 years ago that says it should be possible, but I don't see this add-on/option anymore in the referenced documentation.
I have tried adding the subdomains as a wildcard in heroku by running
heroku domains:add *.myapp.herokuapp.com
but this returned
! Trying to hijack another Heroku app? Tsk, tsk.
Does anyone know if this can still be accomplished and if so, how?
note: I'm currently using my staging environment by CNAMING *.staging.myapp.com to myapp.heroku.com, but would like to clean that up.
Summary of stepsAdd the custom domain to your app with the heroku domains:add command. Look up the Heroku-supplied DNS target for the custom domain using the heroku domains command. Configure your app's DNS provider to point to the Heroku-supplied DNS target. Confirm that your app is accessible via the custom domain.
First open your app in the Heroku web page, then click the "Settings" button https://dashboard.heroku.com/apps/{your app name} Scroll down until you see the "Domains" section, Then click "Add domain" https://dashboard.heroku.com/apps/{your app name}/settings. Input the domain name you purchased from google (eg.
Heroku doesn't provide DNS services therefore there are no name servers. You use your domain name registrars control panel to point your DNS records at your Heroku application. Typically this is a CNAME record pointing at the . herokuapp.com entry.
Domains can be added to both free and paid Heroku apps and adding domains does not incur extra charges. For verification purposes, you must verify your Heroku account to add domains to apps.
Here's how you use subdomains with heroku
Full Details here
Custom subdomains
For each custom subdomain you want to attach to your app (for example, www.example.com), use the
domains:add
command from the Heroku CLI:
$ heroku domains:add www.example.com`
Adding www.example.com to example... done
This is no longer valid: "Subdomains are currently not possible on heroku"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With