What happens when you type google.com in your browser and press Enter
Being a full-stack software engineer means you’re comfortable interacting with any layer of the stack. The answer to this question will reveal how well you comprehend DNS and your general knowledge of how the web stack works on top of the internet. Let’s practice by exploring the infrastructure side (network, servers, security, etc.) of the question.
INTRODUCTION TO HOW THE WEB STACK WORKS
Before going over what happens when you type google.com into your browser, let's first define what a client-server model is. For us to communicate with "Google," we need a Google server (used for Google's web infrastructure) and a computer with a browser (such as Chrome, Safari, Firefox, etc.). The webpage (a basic hypertext document viewable by a browser) also requires some sort of responder from the Google side, which we refer to as a "server" (a computer program or gadget that offers a service to another computer program and its user, commonly known as the "client").?
In this instance, the Google “computer” is a server, while our machine is a client. This isn’t the only thing that happens when you type “www.google.com," though. Let’s take a closer look at the various levels that exist between the client and the server in a client-server approach. Basically, the browser takes a number of steps, which can be outlined as follows:
THE DOMAIN ARCHITECTURE
I’d like to illustrate the domain architecture using the following diagrams:
Outline
Let's look at these levels in a client-server model between the client and the server.
A DNS (Domain Name System) request is sent to ask for the IP (Internet Protocol) address associated with a domain name. This is the first step in the process. The Internet’s DNS system works much like a phone book by managing the mapping between names and numbers. DNS servers translate requests for names like www.google.com into IP addresses like 54.166.173.42, controlling which server an end user will reach when they type a domain name into their web browser.?
Let's explain further: when you type the URL www.google.com into your browser and press "Enter," the browser breaks down the URL into pieces to consider the google.com part first, which is a domain name. The request for www.google.com is routed to a DNS resolver, which is typically managed by the user’s Internet service provider (ISP), such as a cable Internet provider, a DSL broadband provider, or a corporate network. The DNS resolver for the ISP forwards the request for www.google.com to a DNS root name server; again, the DNS resolver for the ISP forwards the request for www.google.com this time to one of the TLD (Top Level Domain) name servers for?.com domains. The name server for?.com domains then responds with the names of the servers associated with the google.com domain. The DNS resolver for the ISP chooses a DNS name server and forwards the request for www.google.com to that name server. The DNS name server looks in the google.com hosted zone for the www.google.com record, gets the associated value, such as the IP address for the web server, 54.166.173.42, and returns the IP address to the DNS resolver. The DNS resolver for the ISP finally has the IP address that the user needs. The resolver returns that value to the web browser. The DNS resolver also caches (stores) the IP address for google.com for an amount of time that you specify so that it can respond more quickly the next time someone browses to google.com. The web browser sends a request for www.google.com to the IP address that it got from the DNS resolver. This is where your content is now. Finally, The web server or other resource at 54.166.173.42 returns the web page for www.google.com to the web browser, and the browser then displays the page.
2. TCP/IP:?
Transmission Control Protocol (TCP), also referred to as the Internet Protocol (IP) Suite, is the World Wide Web’s core communication system that enables every internet-connected device to communicate with every other such device simultaneously. It is a data link protocol that defines how servers and clients interact over the internet to send and receive data.
领英推荐
When you enter the URL www.google.com and press "Enter," your browser looks up the domain's IP address and then establishes a TCP connection with the server. A chain of events begins when a user issues a command that makes use of the TCP/IP application layer protocol. The local machine's TCP/IP protocol stack processes the user's command or message. The command or message then makes its way to the recipient's protocols via network media. The packet must include a header with the addresses of the sending and receiving hosts as well as a body containing the data to be transferred. The protocols at each layer add or remove fields from the basic header as the packet moves through the TCP/IP protocol stack. When a protocol on the sending host adds data to the packet header, it is known as data encapsulation. Additionally, each layer uses a different term to refer to the altered packet.
3. Firewall:?
A firewall serves as a physical barrier between a secure internal network and the world wide web. It is a network security tool that keeps track of and regulates incoming and outgoing network traffic in accordance with predetermined security policies. A firewall may be hardware or software. Software firewalls are installed programs that control network traffic by using applications and port numbers. Hardware firewalls, on the other hand, are the devices installed between the gateway and your network.?
A firewall is a necessary component of any security architecture because it transfers host-level security decisions to your network security device and eliminates their element of uncertainty. Together with an integrated intrusion prevention system (IPS), firewalls can detect and respond to external attacks across the entire network with speed and ease. Firewalls concentrate on stopping malware and application-layer attacks. They can execute quick assessments to find intrusive or suspicious activity, like malware, and stop it. They can also set policies to better protect your network.
4. HTTPS/SSL:?
One of the three essential requirements for a progressive web app is HTTPS, and if you meet this requirement, Chrome and other browsers won't flag your site as "not secure." The "s" in the Hyper-Text Transfer Protocol (HTTP) stands for secure communication. Users of websites can send sensitive data securely over the internet, such as credit card numbers, banking information, and login credentials, thanks to the HTTPS protocol. The SSL certificate initiates secure sessions with the user's browser using the secure sockets layer (SSL) protocol. This secure connection cannot be created without the SSL certificate, which electronically connects company data to a cryptographic key.
5. Load-balancer:?
Load balancers enhance your systems' fault tolerance by automatically identifying server problems and rerouting client traffic to working servers. Load balancing is similar to the work a restaurant manager does. Suppose there are five waiters in a restaurant. If customers were given the option of selecting their own waiter, one or two waiters might be overworked while the others are unoccupied. In order to prevent this scenario, the restaurant manager assigns customers to the specific waiters who are best suited to serve them. Companies usually have their applications running on multiple servers. Such a server arrangement is called a "server farm." User requests to the application first go to the load balancer. The load balancer then routes each request to the single server in the server farm best suited to handle the request. So when “https://www.google.com” is entered in the browser, the load balancer helps distribute the network to the most available web server.
6. Web server:?
A web server is a software program that serves static content, like simple HTML pages, images, or plain text files. Examples of web servers are Nginx or Apache. In order to serve static content as an HTTP or HTTPS response, the web server must locate the location of the static content that corresponds to the address requested. The requests will be processed by one or more web servers after they have been distributed equally among the servers. All the components of a website are stored on a web server, which also handles all browser requests. At the most fundamental level, a browser uses HTTP to request files that are hosted on a web server whenever it needs them. When a request is received by the appropriate (hardware) web server, the appropriate (software) HTTP server accepts the request, locates the requested document, and returns it to the browser via HTTP. (The server will instead respond with a 404 error if it cannot locate the requested document.)
7. Application server:
An application server is a modern form of platform middleware. It is system software that sits in between the user's applications, the operating system (OS), and external resources like a database management system (DBMS), communications, and the Internet. These computer programs, among other things, are in charge of managing user information, interacting with databases, and running applications. They operate behind web servers and can use the static web server content to serve a dynamic application.
8. Database:?
In simple words, data can be facts related to any object under consideration. For example, your name, age, height, weight, etc. are some of the data related to you. A picture, image, file, pdf, etc. can also be considered data.
A database is a systematic collection of data. They support the electronic manipulation and storage of data. Data management is made simple by databases. example Facebook uses a database to store data on people, phone numbers, and other contact details. Your electricity service provider also uses a database to manage billing, client-related issues, handle fault data, etc.
CONCLUSION
When you enter "https://www.google.com" into your browser and press Enter, your browser quickly performs a number of operations. From the Domain Name System (DNS), which transforms "google.com" into an IP address, to the Transmission Control Protocol/Internet Protocol (TCP/IP), which creates a connection to the server, to the security protocols, which encrypt communication between the browser and the server, to the load balancer, which splits incoming network traffic among several servers, to the web server, which processes the HTTP request and returns the requested webpage. The browser will render the page after the web server returns the requested resource, building the Document Object Model (DOM), and adding CSS and JavaScript. The DOM is a tree-like structure that serves as a representation of the webpage and gives the browser control over its content and design. The page is styled and made interactive using CSS and JavaScript.