Most common HTTP headers

The web works under the HTTP protocol.
The web browser uses this protocol to communicate with the web server where the web is hosted, in this case, your WordPress blog.

Each HTTP request that the browser makes to the server is divided into 2 parts:

  • The headers (Headers).
  • The body of the response (Response body).

In the body of the answer is the HTML, CSS, Javascript, etc. code necessary for the web to be seen and to work, that is, what you can see by right-clicking on the web, and clicking on the button “View Source”, or “View source code”.

But also, both the browser and the server, in each request, send some headers that are used to configure various behaviors, or simply to leave a mark with information.

Below is an example of an HTTP dialog:

Our browser makes a query to the server, asking for the web http://www.example.com/index.html :

Request from our browser:

 GET /index.html HTTP/1.1
 Host: www.example.com
 User-Agent: nombre-cliente
 [Línea en blanco]

The server responds to our request

HTTP/1.1 200 OK
Date: Fri, 31 Dec 2003 23:59:59 GMT
Content-Type: text/html
Content-Length: 1221

Página principal de tuHost

(Contenido)
.
.
.


This would be a server response with HTML code, what is there from the tagit would be the response body, while what is before that tag are the headers.

HTTP headers:

HTTP/1.1 200 OK
Date: Fri, 31 Dec 2003 23:59:59 GMT
Content-Type: text/html
Content-Length: 1221

Answer:

Página principal de tuHost

(Contenido)
.
.
.


In this case, in the server response, you can see the headers:

Date: Fri, 31 Dec 2003 23:59:59 GMT
Content-Type: text/html
Content-Length: 1221

Which in this case would indicate:

  • Date header: Indicates the exact date and time at which the server made the response for the record (the server time).
  • Content-type: The Mime Type of the response (if it is a response), or the content uploaded via POST / PUT (if it is a Request)
  • Content-Length: The size of the response in octets (8 bits)

As you can see, reading the HTTP protocol you can get very useful information. Also, each plugin can add its own headers to the WordPress response. Below we will present a list with the most common headers, and some that are not so much:

Most common HTTP headers

  • Server: indicates the type of HTTP server used.
  • Age: indicates the time that the server object has been stored in a proxy cache (in seconds)
  • Cache-control: used by the server to tell the browser which objects to cache, for how long, etc.
  • Content-Encoding: indicates the type of encoding used in the response
  • Expires: Indicates a date and time from which the HTTP response is considered obsolete. Used to manage cache.
  • Location: used to specify a new location in case of redirects.
  • P3P: used to specify the type of privacy policy used on the web. It is not widespread.
  • Set-Cookie: used to create cookies. The famous cookies travel between the server and the browser through these HTTP headers.

There are other non-standard headers such as:

Some examples of uncommon headers:

X-Powered-By: PHP/5.2.6-2ubuntu4.2
X-Pingback: http://www.example.org/xmlrpc.php

As you can see, it is easy to get information by reading the HTTP headers.