user1767238
user1767238

Reputation: 13

Can I have multiple heroku subdomains for my app?

Say you have two apps hosted on heroku: appA and appB. They will be accessible at appA.herokuapp.com and appB.herokuapp.com. Is there a way to "share" the subdomains? As in, can I have appA listening on both urls?

I suppose I could have appB forward all its traffic to appA, but I'm more curious if it can be done through some heroku setting.

Thanks!

Upvotes: 1

Views: 223

Answers (1)

Andrew Gorcester
Andrew Gorcester

Reputation: 19973

No, this cannot be done through a heroku setting. You either need one of the two apps acting as a reverse proxy to the other app, or else you need a third server running a dedicated reverse proxy such as nginx.

Heroku support once suggested using a third heroku app as an nginx reverse proxy with a custom buildpack to accomplish this, although I decided not to go that route. It is unfortunate that there is no systematic support for multiple apps on the same domain at Heroku, but that would add significant complexity to their currently predictable and transparent routing platform (which is itself a non-configurable reverse proxy).

Upvotes: 4

Related Questions