What happens when you type google.com in your browser and press Enter?

Stefania Russi
3 min readJan 31, 2022

You type maps.google.com into the address bar of your browser.

The browser is going to parse the input. Once it decides it must be a URL, it will verify that it has a scheme, if not, it will add “http://” to the beginning. And since it didn’t specify a number of HTTP protocol features, it will assume the defaults, such as port 80, GET method, and no basic authentication.

Then it will create an HTTP request and send it. A DNS lookup “google.com” will be performed, and if it is not already cached, a DNS service will respond with a list of IP addresses, because “google.com” does not only have one IP address. Browsers will choose the first one by default, I think.

Then, the HTTP request hops from node to node until it hits the google.com load balancer IP address. It wouldn’t last long, Google would respond that it needs to use HTTPS, assuming with a permanent 301 redirect. So, it would go back to your browser, the browser would change the scheme to HTTPS, use the default port 443 and forward it. This time, the TLS binding protocol would take place between the load balancer and the browser client. The request would tell Google which protocols it supports (TLS 1.0, 1.1, 1.2) and Google would respond with “Let’s use 1.2”. Then the request is sent with TLS encryption.

The next thing Google would do would be to submit it to the web application firewall rules in its load balancer to see if it is a malicious request. When it passes, the secure connection is probably terminated (because PCI-DSS rules say you don’t need to encrypt internal traffic) and the request will be mapped to a pool in your CDN, and the cached home page on Google’s side will be returned in an HTTP response. Probably pre-compressed.

The Google response header would be read by the browser, cached according to the response header caching policy, then the body would be uncompressed. And because it’s Google, it’s probably ultra-optimized: minimized, probably a lot of pre-rendered content, inline CSS, JavaScript and images to reduce network requests and initial processing time. But that request will trigger a cascade of other requests, all simultaneous because it should be running HTTP/2. While those requests are being made, JavaScript will be parsed, probably non-blocking because they used the defer attribute in their tags, or asynchronous, I never read about what they did individually.

But the browser has probably already generated the search box and is working on the toolbar at the top, which will require some additional network requests: it probably already has a cookie or maybe local storage with an OAuth token, or maybe I’m using Chrome and it already knows who I am, and that request with authentication is sent to their Google+ API that tells the Google search page application who I am.

Another request would be sent to get my avatar image. At this point, they’ve already crawled the browser to see if I wasn’t using Chrome, in which case they would have added a tooltip to tell me that Chrome is awesome and I should use that instead of anything else.

Translated with www.DeepL.com/Translator (free version)

--

--