Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
396 views
in Technique[技术] by (71.8m points)

subdomain - 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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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"


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...