Heroku + node.js: I have a server which uses multiple ports. How can I get Heroku to allocate them?

Okay, after doing some research I’ve found out that opening ports in Heroku is disabled and not allowed.

The only way around this is to use sub-domains and then in-app to use a proxy module (like subdomain-router which I use).

BUT – Heroku don’t let you create sub-domains on their domain, meaning that your-app.herokuapp.com is fixed and cannot have sub-domains.
In Heroku manuals, they demand you to have your own domain and dns provider to do such thing, by creating an A-alias (CNAME) in the dns table in your domain settings, that will refer to your app herokuapp domain, and then using the command heroku domains:add to add your domain to the allowed origin list.

You can read more here. It provides all the info you need.

Hope it helped some.

Leave a Comment