What happens when we enter a URL?

Divya Jain
Techiepedia
Published in
4 min readJan 13, 2021

Have you ever wondered what happens when we type www.google.com or any other URL in the search box? I recently completed the HTTP byte on Crio and here are my key takeaways.

Before answering this question, let us first understand what is DNS?

DNS stands for Domain Name server. DNS is similar to a phonebook i.e, it maps the URL (Uniform Resource Locator- www.google.com) with the IP address of the website([2404:6800:4002:805::2004]:443). You might be thinking that what is an IP address? We can think of IP address as the home address of the webpage. Every URL has a unique IP address associated with it which is stored in DNS.

Format of IP address

When we type www.google.com in our address bar, the browser goes to the DNS server. The DNS server returns the IP address of the corresponding domain name. Now, the browser sends an HTTP request to the server on which the webpage is hosted. The server handles the request, sends back an HTTP response, and returns the webpage as an HTML document along with the other resources like images, CSS & JavaScript if found. And finally, the browser renders the document beautifully to us.

What is an HTTP request?

HTTP stands for HyperText Transfer Protocol. As the name suggests, it is a set of rules for querying the web. HTTP is a request-response protocol i.e, the browser sends an HTTP request to the server and the server returns an HTTP response. It transmits hypertext messages between clients and servers.

Let us now discuss the various HTTP request methods:

  1. GET: It is used to fetch a resource from the server. For eg: when we enter a URL, the browser sends a GET request to the server to fetch the HTML document. Note: data fetched cannot be modified!
  2. POST: It is used when we want to submit the data to the server. For eg: When we submit a form, the browser sends a POST request to the server.
  3. PUT: It is used when we want to update the existing data on the server. For eg: When we update our Linkedin profile, the browser sends a PUT request to the server.

There are several other methods like DELETE, PATCH, OPTIONS, TRACE. You can read about them from here.

Most of you have seen 404 Page not found error but have you ever thought what is the meaning of 404 here. 404 is a response status code. Now, let us dive deeper into response status codes.

Status Codes

Status codes are issued by a server in response to a client’s request made to the server. The browser responds to the request by sending a response message. The first line of the response message is status line which contains a status code(a 3-digit number generated by the server to reflect the outcome of the request) and a reason-phrase (gives a short explanation to the status code). The Status Code is intended for machines whereas Reason-Phrase is for humans.

Here 404 is the status code and Page not found is the reason-phrase.

Status Codes are categorized into 5 different families based on their starting digit.

5 types of HTTP status codes
5 types of HTTP status codes

If you want to learn more about how the internet works, you can always try your hands on chrome developer tools. Open Chrome Developer Tools Ctrl + Shift + i / Cmd + Shift + i in the browser window and select the Network tab.

Thank you for reading! I’ll really appreciate some claps if you find this blog useful :)

Connect with me on Linkedin || Twitter

--

--