What happens when you type https://www.google.com in your browser and press?Enter?
These days, typing an address on our browser and searching for that address is a walk in the park. It has become so simple, we can do it over our computer, tablet and phones. As long as we have a browser, searching has become apart of our daily life. But how many of us actually know what is happening after we hit enter? On this article I will explain what happens at each stage of the journey. So let us dive in and gain some knowledge.
URL
URL (Uniform Resource Locator) is used to uniquely identify a resource over the web. It has 4 parts, but here I will mention the first two parts.
Here I will take the address https://www.google.com and I will first explain the www.google.com part then I will proceed to explain the https.
How does it get converted? Mostly our browser will save the addresses we have visited before. It will then send that IP address over the internet to retrieve the webpage. But what if it is a new address?
Our browser will then try to get the IP address from the OS of our device, but this is a new address, we have never used before. It is most likely that our OS doesn’t have that IP address either. This means they have to search for it in the Resolver server(Internet Service provider).
Even if the resolver doesn’t know the IP address, it knows how to locate the root server which will know how to locate the?.COM Top-Level-Domains, because our address ends in?.com. The TLD will not know the exact IP address but they can locate Authoritative Name Server. This server holds the all the DNS records of domain name, this is the last place you have to go to find the IP address.
But this process is only passed for a new address. So this new IP address needs to be saved, by the browser, OS and the Resolver, for quicker search next time. We now have an IP address, but we still haven’t discussed the https.
2. Protocols: Here I will discuss the https protocol, and I will get into TCP while I am here as well.
What is HTTP first? This is a response and request protocol on how a client and server can communicate. They communicate using hypertext messages. The client communicates, on what to get from server, what to display, what to add, and server gives response of success or failures and displays a webpage. But the address given was HTTPS? The reason for the added letter is for security, ‘S’ stands for secure.
HTTP requests and responses aren’t secure, information passed by it can easily be read and misused because it is in a text format. It lacked security, so that is when HTTPS came.
HTTPS uses another protocol, an encryption protocol, called TLS(Transport Layer Security), it was previously known as SSL(Secure Socket Layer). So how does this security work? Two keys are generated, a private key controlled by the owner of the website that lives in the server where the website is, and public key available to anyone who wants to use the webpage.
When we request a webpage using HTTPS, secure connection needs to be created before the data can be sent. This is done using the SSL certificate we send with our HTTPS which contains the public key to show that we are legit. When the server receives the request it will check the public key using the private key it has. This is called SSL handshake, the client and server exchange what they have to make sure it is similar. When they agree that it is all okay, they encrypt the content to be transmitted, it will not be text format, it will actually look gibberish, and this will then be decrypted when it reaches it destination using the public key that resides with the user.
So we now have an IP address and we know where we are going. We also have a secure way of receiving our content. Next I will discuss about how we are going to send this over the internet.
3. The transport: HTTPS will use any transport protocol over the network, but here I will discuss why it uses TCP(Transmission Control Protocol). TCP is a transport-layer protocol, responsible for establishing a connection between two machines, it is responsible on how to exchange data over network and on which port it should be listening on. For example if it is a HTTP request it will use port 80 but for HTTPS it will use port 443.
领英推荐
There are two ways this can be done UDP and TCP. So that big that data we are requesting or receiving will first be broken to packets for it to be sent over the network. Those packets need to be sent wholly, cause we want the whole content and not some parts of it. The reason why TCP is used is because of its reliability. It will deliver each packet, even if it fails to transmit it, it will retransmit so as no data is lost. Now we have a reliable way to receive our data.
Now let us leave our browser and see what happens when we send our URL over the internet.
?Load-balancer
Load balancer as its name suggest is used for balancing out work so that there won’t be a work overload on a single server. Before the request reaches the server, it must first encounter the load balancer. Load balancer works with the different servers that house the content of the webpage you are requesting. This load balancer will use different algorithms to distribute the work among the servers. This is useful to prevent overload which in return will have a better performance, reliability, reduce SPOF(Single Point of Failure). Ex. HAproxy, NGINX, mod Athena.
But it is google, so it doesn’t just have a single load balancer, it has many, and each one works with many servers to give us all a reliable and fast result. Now our request is going to the server that contains the webpage.
Firewall
Firewall are software or hardware that are used to protect computers from malicious activities. Firewalls are used to filter unwanted packet. Firewalls are programmed to detect certain content, and if the packet that comes contains the malicious content, the firewall is supposed to block it from getting to the computer. Before packet reaches the server, it has to go through the firewall and has to be deemed safe to pass. Now that our packets are considered safe it will be allowed to get to the server.
Server
Server is a computer that provides functionality to other computers or clients. It is a computer whose main job is to serve other computers. Server can be virtual or physical. The physical server lives in datacenters with other servers. They live in stacks in a well conditioned environment so they won’t heat up. The virtual server is a server that lives inside another computer and uses the computer’s resources to serve. It is not a physical one, It is a software. There are many types of servers. Here I will discuss on Web Server, Application Server and Database server.
The data will then go through TCP, the way it came and then back to the client to be viewed. This is what is called a Static Web server. It delivers the webpage as is. This webpage is just to be looked at. It is not interactive. Just the pretty google webpage. But that is not what we use google for. So there must be other things that are missing. These are the Application Server and Database Server.
It is with the help of application and database servers. So we have reached the web server, but that just gave the plane webpage. But if we want to interact with it, the web server sends request to the application server, which in return sends request to database server. Database server checks what the user usually wants to be displayed on the web page, it can be their google account, their preferred language, or their preferred theme. The database sends all this stored information to application server. In the application, all that data will be incorporated to that static webpage from webserver. It will be changed the way the user prefers it. It will not be completely changed, but just enough to make it interactive without loosing its initial integrity. After which it is sent to the webserver and the off where it came from. Below is a diagram that summarizes what I have discussed.
This is the my google home page. It knows I like a darker theme, No add-ons on the google letter and with my Initial on top-right corner, that shows me the available google account to choose from and it is in English.