What happens when you type 'www.google.com' in your browser and press Enter
Introduction
Several processes run in the background mode before your
computer displays the Google homepage when you type
"https://www.google.com" into your web browser and press the enter
key.
Thankfully, all of these events take place in a fraction
of a second and are invisible to you. Have you ever pondered what actually
occurs in the background?
1. Your browser sends a request to the DNS
(domain name system) 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.
2. The browser checks for the presence of
"https://" at the beginning of the URL. This indicates that a secure,
encrypted connection is required between the browser and the website. The
browser then initiates a secure handshake with the web server to establish this
encrypted connection.
3. Once the secure connection is established, the
browser sends an HTTP request to the server, asking for the Google homepage.
This request contains a lot of information, including the type of browser being
used, the language preferences of the user, and the version of the HTTP
protocol being used.
4. The server at Google receives the request and
processes it. It checks the requested URL and looks for the corresponding web
page or file. In this case, it finds the Google homepage and begins to assemble
the content to send back to the browser.
5. The server sends back an HTTP response to the
browser. This response contains the HTML, CSS, and JavaScript files needed to
display the Google homepage. The response also includes information about the
status of the request (e.g., whether it was successful or not) and any
additional metadata, such as cookies or caching directives.
6. The browser receives the response and begins
to render the Google homepage. It first reads the HTML file and creates a
Document Object Model (DOM) that represents the structure of the page. It then
parses the CSS file and applies the appropriate styles to each element on the
page. Finally, it executes the JavaScript code and makes any necessary changes
to the page (e.g., loading dynamic content).
7. The browser displays the fully rendered Google
homepage to the user. The user can now interact with the page, perform
searches, and click on links to navigate to other pages on the internet.
LET'S EXAMINE WHAT
OCCURS IN MORE DETAIL STEP BY STEP:
1. DNS
When you access a website or domain name using your browser, the browser stores information about that domain name (its DNS record).
As a result, whenever you type a domain name into your web browser, such as "google.com," the browser first checks its cache to determine if it has a recent copy of the DNS record for that domain.
It will utilize the IP address stored in the cache to submit a request to the server if a recent copy of the DNS records for that domain is available.
Because a call to the DNS server is not necessary, the process of resolving the domain name to an IP address proceeds more quickly.
The browser will submit a request to the DNS server to resolve the domain name to an IP address if the cache of the browser does not contain a current copy of the DNS record or if the DNS record has changed since it was last cached.
Let's look at the various steps in the DNS lookup process. The DNS lookup process is described in greater detail below:
First, the browser and the operating system checked their caches to determine if they had the IP address for google.com.
Nevertheless, because they didn't, the OS is now contacting the resolver.
b. Resolver
The resolver server is usually your ISP (Internet Service
Provider). All resolvers must know one thing: where to locate the root server.
To see if it has a current copy of the DNS record for that domain, the resolver looks in its cache. If so, the IP address is returned to the browser.
A request is made to a root server if the resolver does not already have a recent copy of the DNS record.
c. Root Server
The resolver then asks the root server: I am trying to find
the IP address for the website google.com. The root server sent the reply.
Sorry, resolver, I don't know where to find google.com. But I can tell you
where to find the.COM TLD server.
d. .COM TLD server
I am afraid I don't know the IP address for google.com, but
I have found the authoritative name servers! The.COM domain found the
authoritative name servers for the domain google.com.
e. Authoritative Name Severs
The authoritative name server responds with
the IP address for google.com. Google's IP address is 8.8.8.8. The resolver
then sends the IP address to the browser.
The resolver finally got the answer he was looking for! Hurray
for the authoritative name server!
It was so cool visiting everyone!
The root told me where to find the.COM server.
The TLD server gave me the authoritative name server addresses.
Then, ns1.google.com gave me the IP for google.com.
2. TCP/IP
TCP/IP stands for Transmission Control Protocol/Internet
Protocol. TCP/IP is a set of standardized rules that allow computers to
communicate on a network such as the internet.
TCP works with the Internet Protocol (IP), which defines how computers send packets of data to each other. Together,
TCP and IP are the basic rules that define the internet.
They work together to establish a connection between a client
and a server and facilitate the transmission of data between them.
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 an acknowledgment
acknowledging the request to establish a connection. This is the three-way
handshake protocol.
Once the three-way handshake protocol 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.
3. FIREWALL
A firewall is a security system that monitors and controls
incoming and outgoing network traffic based on predetermined security rules.
Its primary purpose is to protect a network from external threats, such as
hackers and malware.
When you type "google.com" into your browser's URL, the
request that your browser makes to Google's server passes through the firewall
on its way there. 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.
4. 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.
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.
Let me use an analogy to explain what is going on here.
HTTPS is like a locked box that is used to send messages over
the internet. When you want to send a message using HTTPS, you put the message
in the locked box and send it to the person you want to receive the message.
Only the person you are sending the message to has the key to unlock the box
and read the message.
SSL and TLS are like special codes that are used to lock and
unlock the box. When you want to send a message using HTTPS, you and the person
to whom you are sending the message must agree on the code to use to lock and unlock
the box. This way, only you and the person to whom you are sending the message
know the code and can read the message.
When you type "google.com" into your browser, the
browser is like the person sending the message. The server that hosts google.com is
like the person receiving the message. The browser sends a request for the
webpage using HTTPS, which is like putting the request in a locked box and
sending it to the server. The server then sends the webpage back to the browser
using HTTPS, which is like putting the webpage in a locked box and sending it
back to the browser.
5. LOAD-BALANCER
A load balancer is a device that acts as a reverse proxy and
distributes network or application traffic across a number of servers.
Its primary function 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.
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.
In the case of a browser trying to access google.com,
the load balancer would 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.
6. 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, which would typically include the 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.
7. APPLICATION SERVER
Unlike the web server, the application server handles dynamic
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 specific product on an
e-commerce website, the application server may need to retrieve information
about the product 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.
8. DATABASE
A database is an organized collection of structured information,
or data, typically stored electronically in a computer system. A database is
usually controlled by a database management system (DBMS). There are two types
of databases: relational and non-relational, which both use DBMS to create,
edit, delete, and maintain data. In this case, the content of what you search
for will be stored in a database.
CONCLUSION
The Google server receives
an HTTP request from your browser when you input https://www.google.com and
click Enter, and it responds by providing the necessary files to display the
Google homepage. You can use the browser to engage with Google's search engine
and other services after it processes these files and presents the page to you.
Thanks to the robust network infrastructure that supports the internet, the
entire process is completed in a couple of seconds.
Comments
Post a Comment