What happens when you type 'www.google.com' in your browser and press Enter
Thomas Nwodo
CTO at Live More | Full-Stack Developer | Healthcare Transformation Advocate. High Technical Officer at Research Institutes, Umudike, leading AI-driven IoT projects to advance environmental and agricultural research.
Table of Contents
- A brief explanation of what happens when you type a URL into a web browser
- DNS Request
- DNS Lookup
- TCP/IP Connection
- Firewall
- HTTPS/SSL
- Load Balancer
- Web Server
- Application Server and Database (if applicable)
- Rendering the Page
- Conclusion
A brief explanation of what happens when you type a URL into a web browser
Have you ever wondered what happens behind the scenes when you type a URL in your browser and press Enter? In this article, we will explain the various stages involved in the process of loading a webpage, using https://www.google.com.
Before I procced to explain the steps involved when you typed URL https://www.google.com, into your web browser. Let me explain few terms that will help you understand and appreciate what happens behind the scenes whenever you open a web browser and type https://www.google.com.
- URL stands for Uniform Resource Locator. This is the address that points to the place (web page) you want to visit. Example https://www.google.com
- Web browser is an app that you use to access the web. Common examples are Chrome, Firefox, Safari, Edge, etc.
- https:// - hypertext transfer protocol secure is a set protocol used to establish a connection to the network.
- www?-?subdomain?is a subdivision of the domain name typically used to distinguish content types or the type of information presented. Usually, subdomains point to specific server IP addresses serving a page.
- Second-level Domain- This is the unique name of the website for the company or person that registers it. This enables brand or owner identification for each site.
- Top-level domain- This is the highest level of domain which specify the entity or organization under which the site is registered. Examples are 'org' , 'edu', 'com'
From the network diagram illustration above, here are the things that happen when you type www.google.com and hit enter on your computer keyboard.
- Your computer sends a request to the domain name system (DNS) server which serves as an address book for all domain names. This then sends back the exact IP address of the server which?https://www.google.com?points to.
- Your computer then establishes a connection with the server through the IP address. The type of this connection is known as Transmission Control Protocol (TCP) and your computer is able to establish this connection through the Internet Protocol (IP). This whole process is known as a "handshake".
- If your computer is behind a firewall, the firewall checks to ensure that the particular request you are making is allowed before permitting it. Also, if the server you are trying to access is also behind a firewall, a similar check will be done before you are finally able to connect to the server.
- After establishing the connection, your browser now sends a request for the webpage using an encryption protocol like Secure Sockets Layer (SSL) or Transport Layer Security (TLS) in order to encrypt the data that will be shared between your computer and the server. This type of encryption is what is responsible for the "s" in "https" which also implies that the connection is secure.
- Companies like Google, Twitter, Facebook etc with high traffic maintain a host of servers and for that matter they have a load balancer that receives most of the requests and sends it to a particular server. The request from your browser will therefore hit the load balancer first which will forward it to a specific server depending on the algorithm used by the load balancer.
- The server that receives the request then sends a response back to the load balancer which also forwards the response back to your browser. This response will mostly include HTML, CSS, and JavaScript files that makes up Google's homepage.
- The HTML files returned tells the browser how to render the content of the page. The CSS file tells the browser how to style the content while the JavaScript file adds interactivity to the page.
- If there is a need for some dynamic content such as Google search results, then the web server will make a request to the application server, which in turn may make a request to a database server to get some data and send it back to the web server. The web server will then include these in the response that it sends back to the browser.
- Your browser will render the page and display it to you.
The whole process happens within microseconds that displays google home page on your browser. Now let us go into detail of our discussion "The things that happens when you type URL "https://www.google.com".
DNS Request
When you type https://www.google.com in your browser, the first thing that happens is a DNS (Domain Name System) request. Your computer sends a request to the DNS server, asking for the IP address of the website you are trying to access. DNS is like a phonebook for the internet, translating human-readable domain names into machine-readable IP addresses. Once the DNS server receives the request, it responds with the IP address of the website.
DNS lookup process
Here's how the DNS lookup process works in more detail:
- The browser sends a request to the local DNS resolver, which is usually provided by the internet service provider (ISP).
- The local DNS resolver checks its cache to see if it has a recent copy of the DNS record for the domain. If it does, it sends the IP address back to the browser.
- If the local DNS resolver does not have a recent copy of the DNS record, it sends a request to a root nameserver.
- The root nameserver responds with the address of a top-level domain (TLD) nameserver, such as .com or .org.
- The local DNS resolver sends a request to the TLD nameserver.
- The TLD nameserver responds with the address of the authoritative nameserver for the domain.
- The local DNS resolver sends a request to the authoritative nameserver.
- The authoritative nameserver responds with the IP address for the domain.
- The local DNS resolver sends the IP address back to the browser.
- The browser sends a request to the server at the IP address to retrieve the webpage.
This process may involve additional steps if the DNS record is not found at any of the nameservers, or if the DNS record has been configured to use a service such as DNS load balancing or content delivery networks (CDN).
Once the IP address has been resolved, it is cached by the local DNS resolver and the browser so that future requests for the same domain name can be resolved more quickly.
The length of time that the DNS record is cached (the "TTL," or Time To Live) is determined by the authoritative nameserver and can be configured by the domain owner.
TCP/IP connection
The next step is establishing a TCP/IP (Transmission Control Protocol/Internet Protocol) connection. TCP is responsible for ensuring the reliable delivery of data packets, while IP handles the routing of data packets between devices on the internet. Your computer sends a SYN (synchronize) message to the server, which responds with a SYN-ACK (synchronize-acknowledge) message. Your computer then sends an ACK (acknowledge) message, establishing a connection.
When you enter "google.com" into a web browser, the browser uses TCP/IP to establish a connection with the server that hosts the website.
Here's what happens in more detail:
- The browser sends a request to the server using IP to establish a connection.
- The server receives the request and sends back a message acknowledging the request to establish a connection. This is the handshake process.
- Once the handshake is complete, the browser can send a request for the webpage it wants to access (in this case, the homepage of?google.com). This request is sent using TCP, which ensures that the request is transmitted reliably and in the correct order.
- The server receives the request and sends back the HTML code for the homepage of?google.com?to the browser. This response is also sent using TCP to ensure reliable transmission.
- The browser receives the HTML code and uses it to render the webpage on your screen. Any resources (such as images) that the webpage needs are also requested and received using TCP/IP
Firewall
A digital security system that monitors and control all incoming and outgoing traffic on a network according to a defined set of rules. A firewall blocks unauthorized traffic and allows only communications that are considered safe, using a set of security rules provided by a network administrator.
When you type a URL like "google.com" into your browser, the request that your browser makes to Google's server passes through the firewall on its way. The firewall checks the incoming request to make sure it is allowed based on its security rules.
There are two main types of security rules that a firewall uses to check incoming requests:
- Rules that allow or block?traffic based on the source and destination?of the request. For example, a firewall may be configured to block all traffic from certain countries or to allow only certain IP addresses to access the network.
- Rules that allow or block?traffic based on the type of traffic. For example, a firewall may be configured to block all traffic on certain ports (such as those used by malware) or to allow only certain types of traffic (such as HTTP or HTTPS).
If the incoming request meets the security rules set by the firewall in front of Google's server, it is allowed through, and the browser is able to access the website.
However, if the request does not meet the security rules, it is blocked, and the browser is unable to access the website.
领英推è
HTTPS/SSL
HTTPS (Hypertext Transfer Protocol Secure) is a secure version of the HTTP protocol used to transmit data on the internet. It is used to encrypt the data transmitted between your browser and Google's server.
SSL (Secure Sockets Layer) and TLS (Transport Layer Security) are encryption protocols that are used to secure the data transmitted over HTTPS.
After TCP/IP connection is done, the browser then communicates with the server using the protocol?HTTPS?in the URL. The protocol defines different types of requests (ie;?GET,?POST, and?PUT) and responses secured by a standard security protocol?Secure Sockets Layer?(SSL) that encrypts and decrypts data traffic between the client to the server infrastructure at the load balancer.
When your browser establishes a connection with Google's server using HTTPS, your browser and Google's server first agree on the version of SSL/TLS to use and then create a secure, encrypted channel for transmitting the data.
Load Balancer
A load balancer is a device that distributes incoming network traffic across a group of servers or resources.
The primary function of a Load Balancer is to ensure that the traffic is distributed evenly across the servers in order to avoid overloading any single server and to increase the overall capacity and reliability of the system. The load-balancer uses various algorithms to determine which server to send the request to.
When a browser is trying to access?google.com, the load balancer will receive the incoming request from the browser and then forward it to one of the servers in the Google server network.?The particular server chosen will depend on the type of load balancing algorithm implemented.
After the HTTPS handshake is completed, the request is passed on to a load-balancer.
A company like Google, which receives billions of website visitors a day, will need a lot of servers to serve all these users. Therefore, there will be a need for them to set up a load balancer to ensure that some of the servers are not overburdened while others are being underutilized.
Web server
A web server is a computer program that is responsible for handling requests for web pages from clients (such as a browser trying to access?google.com). When a client sends a request for a web page to a web server, the server processes the?request?and returns the appropriate?response?to the client.
This means that when trying to access?google.com, Google's server will receive a request from the load balancer.
The web server would then process the request and generate a response, in the form of HTML, CSS, and JavaScript files that make up the web page.
The web server would then send this response back to the load balancer, which would forward it on to the browser. The browser would then use the HTML, CSS, and JavaScript files to render the web page for the user.
Application Server and Database Management System (DBMS)
The application server handles dynamic content while web server handles static content. When using "google.com", the application server will be responsible for generating the search results (which change based on the query you put into the search engine).
When you submit a search query to Google, the request is first sent to the load balancer, which forwards it to one of the web servers in the Google server network. The web server then sends the request to the application server, which processes the request and generates the search results.
Depending on the complexity of the search query, the application server may need to make a request to a?database?in order to retrieve the necessary data.
For example, if you are searching for a particular student on a school management system website, the application server may need to retrieve information about the student from a database.
Once the application server has obtained the necessary data, it sends it back to the web server, which includes it in the response that is sent back to the browser. The browser then uses this information to display the search results to you.
A database management system is a software system that facilitates the organization of data into a particular architecture, be it relational (Relational Database Management System, or RDBMS), document store, key-value store, column-oriented, graph, or other.
Rendering the page
When a browser receives a response from a web server, it processes the HTML, CSS, and JavaScript files that are included in the response in order to render the web page.
The rendering process involves interpreting the HTML and CSS code, rendering any images or other media that are included on the page, and executing any JavaScript code that is present on the page.
The browser receives the response from the web server, which includes the HTML, CSS, and JavaScript files that make up the Google web page.
Once the page has been fully rendered, you can now interact with it by clicking links, entering text, or interacting with other elements on the page.
Conclusion
This article is my submission to the task on technical writing as part of the ALX Africa Software Engineering Program. I do hope you learnt something new and now understand clearly what exactly happens when you type "google.com" into your browser.