Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a subsubdomain for an app on heroku: (e.g. sub.myapp.herokuapp.com)

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.

like image 316
HectorMalot Avatar asked Dec 29 '12 13:12

HectorMalot


People also ask

How do I add a subdomain to Heroku?

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.

How do I add Google domain to Heroku?

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.

Is Heroku a DNS provider?

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.

Does Heroku give free domain?

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.


1 Answers

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"

like image 200
Eric Fode Avatar answered Sep 23 '22 23:09

Eric Fode