Home > Software engineering >  Does Heroku domain name point to the environment PORT?
Does Heroku domain name point to the environment PORT?

Time:08-31

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?

CodePudding user response:

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.

  • Related