Hello friends, in today’s article we are going to discuss “what happens when we visit a website and how the website works”.These days web application security is in high demand so if you want to get into cyber security then you have to know about how websites work. Mainly we will talk about the HTTP protocol and how browsers and servers communicate with each other.
What is HTTP protocol?
HTTP is known as the hypertext transfer protocol. All the websites on the internet run on HTTP protocol. HTTP protocol works on port number 80 and when you visit a website then browsers use the HTTP protocol to connect with the server. Then the server responds to your requested sources after that you can see a website. But you will regret this point because you can see a website where you have HTTPS protocol and works on port number 443. HTTPS protocol works only to transfer data in encrypted form and in the backend the website works on HTTP protocol, and we have to test a website on HTTP protocol only.
What happens when you visit a website?
When you visit a website then the browser creates an HTTP message for the server which contains a lot of headers. If you want to see the website Header and HTTP message then you can use Burp Suite Tool.
Above you can see the HTTP message which contains a lot of headers. Now we will discuss those types of headers:
- In the first line, you can see the HTTP request contains 3 items. That is an HTTP method and GET is the most commonly used method here that tells the server for a resource from a given location. The second item is the path of files stored on the server. The third item is an HTTP version which indicates what HTTP version your browser is using.
- Host header specified hostname or website name. This is required when multi websites are hosted on a server. The host header indicates the server from which the web application is requesting sources from a server.
- The user-agent header tells us about the browser where the user wants to visit a website.
- Accept header specifies what type of resources the website is accepting.
- A cookie Header is used to submit additional information to the server about a client such that when a user visits again on the same website the server easily recognizes the user & the user can access resources without authenticating again. After some days cookies will be expired automatically & after a fixed time a new cookie is formed by the server.
How do servers respond when you visit a website?
When we visit a website then an HTTP message will be sent to the server by the client or Browser. In response, browsers send an HTTP response you can see below.
Here we will discuss HTTP response headers:
- In the first line, you can see three items which first is the version of HTTP used by the Browser and 200 is a status code that indicates the browser loaded all the resources from the server and the last item is OK that indicates HTTP Response had been reached successfully.
- The content type header specified how the website accepts resources from the server.
- The date header indicates the time of HTTP response.
- Expire header tells us when the current session will expire.
- The server header is used to tell the server where all resources are stored and it also tells which operating system and which version is server using.
- The content length header indicates the length of the HTTP messages in bytes.
There are some other headers also you can see in the image but we have discussed only the important ones. All header works in the backend of our server & browser so a website user cannot see it. If you want to capture these requests then you have to use tools like BurpSuite.
In this article, “We have discussed how websites work and what happens when you visit a website?” All website works on HTTP protocol and communicates to the server with an HTTP message. In response service and HTTP response contains a lot of headers we have discussed above. If you like the article, then share it with your friends such that they can also enjoy it & know how the website works.