Vhost undefined on my app hosted on Heroku

133 Views Asked by At

I've just set up an express app on Heroku. I'd like multiple subdomains of my domain to point to my Heroku app (ex : name1.mydomain.com, name2.mydomain.com, ...). As there's no specific app for each of these domain, I'd like to be able to know trough which subdomain my app was accessed in order to respond with the correct data.

Thus, I've setup the vhost module in order to retrieve these informations. It works well on localhost but when using it on Heroku, it always returns undefined.

I've also tried with req.hostname but it always returns 0.0.0.0 whatever the subdomains I accessed the app trough.

Do you have any idea how I could retrieve the information of the subdomain trough which my app hosted on heroku was requested.

0

There are 0 best solutions below