Is every HTTPS and HTTP connection always linked to port 443 and 80 respectively?

Asked

Viewed 77,173 times

15

Every HTTP connection always has port 80 and every HTTPS connection always has port 443?

Because I realize that browsers don’t need you to pass the port to make connections to those specific ports.

Every HTTP and HTTPS connection has ports 80 and 443 respectively, or is this a standard (default or fallback)?

  • 1

    Default pattern sounded kind of weird.

  • 1

    @diegofm was supposed to be parenthetized

1 answer

24


Not necessarily. Doors 80 and 443 are the doors pattern for HTTP and HTTPS respectively. However, in many situations, you can use other.

For example, my Tomcat goes up at port 8080. When I put two services on my machine, one goes up at 8080 and the other at 8081.

In practice, you can use http://www.example.com:1234 to denote that you want to access the site www.example.com via HTTP at port 1234. When using https://www.example.com:1234, you use HTTPS instead of HTTP. When the port number is omitted/missing, port 80 will be used if it is HTTP or 443 if it is HTTPS.

In theory, nothing would stop you from posting your website at the door you want, and there are some sites that actually do that. However, this doesn’t usually work because there are many firewalls out there that block connections on ports that are not explicitly released, and whereas ports 80 and 443 are the standard HTTP and HTTPS ports used by 99% of websites around the world, they are usually always free, while when using the other ports, you will possibly have problems with users who report not being able to access your site properly.

Another advantage of using standard ports is that you don’t need to put the port number on your Urls, which tends to be something desirable for most sites. Also, when the user is going to type a URL in the browser, he will probably try to type www.example.com instead of www.example.com:1234.

On the other hand, by not being required to use the standard port always, it is possible to make more than one HTTP/HTTPS service available on the same machine. Since the doors in use are reserved to the services that listen to them and it is not possible to run two services at the same time on the same machine, on the same IP and on the same door, So if you have a service running on the HTTP protocol at port 80 and you want to provide another service that also runs on the HTTP protocol on the same machine with the same IP, then you have to use a different port. But when using a non-standard port, it will fall into the problems described above. For this reason, some people use proxy/gateway services, where the proxy/gateway is an HTTP/HTTPS service that uses the default ports (80 and 443) and it redirects to the other local services that run on other ports. In this approach, there must be some simple criterion that allows the proxy/gateway to know which service it will redirect to (ex, clientes.example.com goes to door 1234 and the fornecedores.example.com goes to 4321). With this, there will be a single service visible externally running on the standard door, while internally there will be several services running on alternative doors.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.