Celeb Glow
news | March 04, 2026

What is the usage of the port number in an HTTP GET request?

In an HTTP GET message, there is a HOST field:

Host.
The domain name of the server (for virtual hosting), and the TCP port number on which the server is listening. The port number may be omitted if the port is the standard port for the service requested.

In this field, there is a port number. I know that port number is on the transport layer. So what is the port number in an HTTP GET message used for?

1

1 Answer

It's useful for several things, one of which is for generating URLs in proxies. I might have nginx configured as a load-balancing proxy on port 80, while the actual HTTP server is running on port 7790. If the web server needs to create an absolute URL back to itself, it can't use the transport layer information, because that'll just give it the internal network info. It needs to look at the HTTP headers to know what the real client is and how they are accessing the server to generate the URLs.

5

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy