Home > Software engineering >  Why do we use port number localhost: 8080? Why don't we use a port number when using www.exampl
Why do we use port number localhost: 8080? Why don't we use a port number when using www.exampl

Time:04-26

When I use a Spring Boot app in local it uses, localhost:8080. When it is pushed to Pivotal Cloud Foundry, it has some route https://my-app.xyz-domain.com and we can access the URL without a port, what is happening behind the scene?

Please help me understand.

CodePudding user response:

There is a default port number for each protocol which is used by the browser if none is specified. For https it is 443, for http 80 and for telnet 23.

On Unix and similar systems like Linux, those are often not available to a developer so other ports are used but then they have to be specified. 8080 is often available and looks like 80.

CodePudding user response:

First, you should change the port to 80 or 443, because HTTP corresponds to 80, and HTTPS corresponds to 443. Then, you should set the domain name to resolve to the current host, so that you can access the current application through the domain name. In addition, if you want to set the local domain name, then The hosts file should be modified.

  • Related