Does Heroku domain name point to the environment PORT?

Issue

When putting a MERN app into production via Heroku, you have to assign the Express server to a port environment variable. When in production, does a heroku domain name point to that particular port, so that you can access the express server?

Solution

When in production, does a heroku domain name point to that particular port, so that you can access the express server?

Technically, domains don’t point to any port. But the Heroku routers do what you expect them to do:

Inbound requests are received by a load balancer that offers SSL termination. From here they are passed directly to a set of routers.

The routers are responsible for determining the location of your application’s web dynos and forwarding the HTTP request to one of these dynos.

Users of your application don’t need to know (and, generally speaking, cannot know) what port your application is binding to. That is an internal runtime detail. Heroku automatically routes requests to your running application.

This is true whether the "user" of your application is a human being using a web browser, or whether it’s a front-end application that might be running on a completely different server.

Answered By – Chris

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published