What happens on a HTTP request?

So lets look behind the scenes and see what exactly goes on when you type www.yahoo.com in your browser?

  1. Your browser will first check if it knows the IP address to which yahoo.com domain matches? This domain-IP mapping can be stored in the browser cache when the browser looks it up for the first time.
  2. If the browser cannot find the domain-IP mapping in it’s cache, it will send a DNS request to the ISPs DNS server. The DNS server will lookup and find the IP mapping for www.yahoo.com. It will then respond with the IP address.
  3. The browser will get the IP address from DNS server and send the HTTP request for www.yahoo.com to that IP address.
  4. The server running at that IP address should be hosting the domain yahoo.com.
  5. The server will look at the incoming request. If the incoming request is a request for an HTML page it will serve it directly back to the client.
  6. If the request is for a PHP page, then the request will be sent to the PHP engine/module running on the server. The PHP engine/module will execute the PHP code and generate an HTML page will it will be give back to the HTTP server.
  7. The HTTP server will then send this HTML response back to the client’s browser.
  8. The browser will then render yahoo.com webpage for the client.

Looking behind the scenes always helps to get a better understanding and complete picture of how things work.

Posted in Basics, DNS, HTTP. Tags: , , , .

Leave a Reply