WHAT HAPPENS WHEN YOU ENTER A URL IN YOUR BROWSER?
Hey guys, Welcome to my blog. I hope you enjoyed my last story about HTTP & HTTPS.
Today I would like to discuss about URL i.e “Uniform Resource Locator” which most of the people uses on a daily basis but don’t know the mechanics behind it. So, what exactly happens when you type a URL in your browser and press ENTER? Let’s See…
A. When you type an URL in your browser and press ENTER, the browser tries to find the ip address from the browser cache, OS cache etc. If it’s not found in there, it then tries to find the ip address of that domain via DNS i.e Domain Name System.
But what is DNS and How does it work?
DNS or “Domain Name System” is a service that helps in translating domain names to ip addresses and vice versa.
- When a computer needs to reach a domain (like https://www.youtube.com), it sends a request to a server called ‘DNS Resolver” or DNS server. If the mapping is found for the domain in the DNS cache, the server returns the ip address.
- If not, the Resolver reaches out to Root Server. Root Servers hold the index of Top Level Domains (TLD). There are 13 root servers globally.
- TLD Name Server gives the ip address of the Authoritative Name Server that holds the mapping for the requested domain name.
- If the Authoritative Name Server has access to the requested record, it will return the ip address.
5. This ip address is then returned to the client that made the original request.
Let’s get back into the main topic here..
B. After getting the ip address of the requested domain, the browser tries to initiate a TCP Connection via TCP 3-Way Handshake process.
I will make a separate blog for this sometime soon.
C. The browser sends a HTTP request to the server.
D. The server sends back a HTTP response to the browser in a JSON,XML and HTML format.
E. The Server sends back the response along with the Status Code of the request.
F. Then for each requested pages the C & D steps are repeated again and again.
This is how it works.
This is it for now. Let me know in the comment section if I missed anything or if it helped to clear any confusion you had.
Until next time…