HTTP request

A HTTP request is a message created by a HTTP client to request for a resource from a HTTP server. For example, when you access our homepage, your browser will first create a HTTP request to get a HTML document from our server:

GET / HTTP/1.1
Connection: keep-alive
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9

As shown above, a typical HTTP request includes the following information:

  • A request method (GET)
  • The requested resource (/).
  • The protocol version that this request was created with (HTTP/1.1).
  • The host name of the server (
  • Whether to keep the underlying TCP/IP socket alive for the next HTTP requests. (Connection: keep-alive)
  • The identification string for the HTTP client that sends this request. (User-Agent: Mozilla/5.0 ...)
  • The type, encoding and language for the content that the HTTP client will accept. (Accept*)

For the most part, a web browser typically creates several HTTP requests for server resources in its attempt to render a web page on screen.