HTTP request and response lifecycle

Kelleymb
1 min readAug 21, 2020

--

First things first, it’s important to understand what exactly a web server’s role is in the HTTP request/response lifecycle.

So what does a web server do exactly?
A web server reads and interprets URLs and HTTP requests so that it can, in turn, serve up static files to the client in response (HTML, CSS, JavaScript, and image files).

What is a URL and how is it broken down?
A URL, aka a Uniform Resource Locator, consists of the following: protocol, domain, port, path, and a query string. See example URL below…

http://www.thisisadomain.com:80/path/to/my/resource?key1=value1&key2=value2

httpprotocol
www.thisisadomain.comdomain
:80port number
/path/to/my/resourcepath
?key1=value1&key2=value2query string

Breakdown of the HTTP request/response lifecycle:

  1. A user types the URL
  2. The browser sends the request and specifications to the server
  3. The server interprets the request, using a route handling function to interact with the database, form the response data, and set the response status
  4. The server sends the response. Something along the lines of 200OK, 304 Created, 401 Unauthorized, or 500 Internal Server Error. These are just some examples of the HTTP response codes that you will be exposed to
  5. Browser Interprets Response and displays data from the server to the client

Thank you for reading!

--

--

Kelleymb

Hello, world! I’m Kelley, just a girl documenting her coding journey.