Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
401 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 Reply

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"


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...