Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do my browser knows it needs to connect to port 443 or port 80?

This is what I am trying to do:

  1. Open a browser and start to browse any https website like Gmail or Google.com

  2. I can see through Wireshark that the name resolution is being done by the DNS server.

  3. But after that, the connection is directly established to port 443 (starting from TCP handshake)

  4. One thing I am not able to understand is, how does the browser knows that it needs to connect to port 443, I tried exploring the DNS packet, but it contains only the destination address, and there is no info which tells that it needs to connect to port 443.

  5. Even if say, the browser has a priority in querying for the first time, it sees that if the port 443 is open then connect to it or connect to port 80, but I am not able to see any such behavior if I connect to a normal HTTP website, in the sense that, if I go to a normal HTTP website, there is no traffic flow from the browser indicating that it had searched first the port 443 and then went to port 80.

I am sure that I am missing something here, but not sure what it is.

like image 731
hsengiv86 Avatar asked Oct 26 '25 18:10

hsengiv86


1 Answers

The presence of https: in the URL tells it that.

like image 192
user207421 Avatar answered Oct 29 '25 20:10

user207421