The HTTP protocol and the analysis of HTTP headers

Analyze the HTTP headers of your pages using our free tool:


Analyze your web pages with our free SEO Page Analyzer :
ANALYZE


To start the analysis, simply enter the link to your page in the area above and click the Analyze button.

You can then access the analysis report on the HTTP header of the request and the response from your page. For each HTTP header, you can see the list of all the fields contained by the HTTP headers. The tool also provides the HTTP header code of the HTTP response. The core values ​​are listed below. The main values are listed below.

This HTTP viewer (in English : HTTP Viewer) is a very practical tool used for verifying the technical points (compression, errors...) and the website's SEO (the301, 302 redirections...)

What is a HTTP protocol?

The HTTP protocole (acronym for Hypertext Transfer Protocol) is the network protocol used by the web browsers (Firefox, Internet Explorer...) and the web servers (Apache, IIS...) to communicate between them. This one is used for example to obtain an HTML file, an image, or when posting an Internet form. It is thus at the heart of the Internet. Technically it is a text protocol (ie human-readable) based on TCP and IP lower level protocoles

The search engines robots such as Googlebot which are exploring websites (in English: crawling) also use the HTTP protocole to communicate with the Web servers.

With the HTTP protocole the communication between a browser and a web server is finally very simple. Here is the course :

  • a URL like http://www.monsite.com/fichier.html is given to the browser by an Internet user
  • the browser extracts the domain name 'www.monsite.com' and based on this information it will find out how to find the remote Web server (through a process called DNS lookup to resolve a domain name into an IP address)
  • from there a connection (based on TCP / IP protocols) is established between the browser and the remote web server
  • a HTTP request requesting the resource '/fichier.html' is then transmitted by the browser
  • the Web server finds the corresponding resource and returns the content in an HTTP response
  • the browser is now capable of displaying the HTML file to the user

The HTTP header of a request

Here is an example of header request sent by a browser such as Safari:

GET /fichier.html HTTP/1.1[CRLF]
Host: www.monsite.com[CRLF]
User-Agent: Mozilla/5.0 Safari/531.9[CRLF]
[CRLF]

The first line always contains: the type of application, the URL path to the target resource and finally the version of the protocol (usually 1.0 or 1.1). The two main types of application known are:

  • GET : that is to get a resource. This is of course the most used application on the Internet.
  • POST : this is to send the the content of a HTML file (the information is rendered in

The [CRLF] symbolize a ASCII sequence [10-13], called [Carriage Return - Line feed]. This is in fact a delimiter used by the HTTP protocol to separate the header lines.

The following lines are HTTP fields , always formatted in this way "NomChamps: Value". All this is the header of the request. In some cases (for the POST), it can also be a body for the query.

The HTTP header of a response

Here is an example of a response header sent by a web server such as Apache:

HTTP/1.1 200 OK[CRLF]
Date: Thu, 24 Sep 2009 19:37:34 GMT[CRLF]
Server: Apache/2.2.3[CRLF]
Content-Length: 7234[CRLF]
Content-Type: text/html; charset=UTF-8[CRLF]
[CRLF]
[here is the body of the response]

The first line of the response always contains the 'code' indicating whether the HTTP request was successful or not. Then, as for the response, there are lines of HTTP fields. All this is the header of the response. Next there is the body of the response, which in the case of a GET of a HTML file contains for example the HTML code of the referred page.

The lost of the HTTP codes

Even as a simple internet user, you can be faced with HTTP response codes (eg when typing an incorrect URL). Here is a description of the main values ​​to know:

Code HTTP Explanation
200 HTTP Code : Ok This means that all is well and that the Web server returns the contents of a resource in the body (body) of the response
301 HTTP Code : Moved Permanently This is a permanent redirection towards a URL indicated in the response ('Location' fields). This redirection is considered 'Google Friendly' and does not affect your SEO
302 HTTP Code : Moved temporarily This is a temporary redirect to a specified URL. It is less appreciated by Google
400 HTTP Code : Bad request This means that the request received by the web server does not follow the format defined by the HTTP protocol
401 HTTP Code : Unauthorized This means that access to the URL is secured. The Web server also asks you to provide a login / password
HTTP 403 Code : Forbidden This means that an invalid login/password has been provided to access a secured URL
HTTP 404 Code : File not found This means that the Web server can not find a resource corresponding to the specified URL
HTTP 500 Code : Internal Error This means that the web server was not able to handle the HTTP request. This may indicate a serious problem.

A list of the main HTTP fields (in English : HTTP fields)

It is useful to know the most used HTTP fields :

For the requests :

Name of the HTTP field Explanation
Host This is the name of the domain in question. A web server can manage multiple domains at the same time on the same machine. We then say that it manages 'virtual hosts'.
User-Agent this field is used by the browsers to indicate their name. The search engines crawlers also use this field to gain recognition (ex: Googlebot pour Google)
Referer when a user clicks on an external link from a page, the browser indicates in this field the URL of the source. This can be very useful for analyzing the source of our traffic.

For the responses :

Content-Type the Web server indicates the type ('MIME type') of the resource it sends (image, html, pdf...). Sometimes it can even indicate the character encoding of the content. For example: text/html; charset=UTF-8
Server the Web server indicates its signature in this field.
Set-Cookie the Web server (sometimes guided by the code lines of a website developer) can indicate to the browser values of the cookies. These values will be returned by the browser in future queries.
Location It is the field used during redirects to indicate the new target URL

Do I have to know the HTTP protocol to create my Website or to SEO optimize it?

Of course it is possible to manage and even create a website without knowing anything about the HTTP protocol. This is good, otherwise there would be few websites on the Internet!

However, this protocol is so ubiquitous on the Internet that a minimal knowledge of the HTTP and of the vocabulary that surrounds it is often very useful. For example this will allow you to :

  • to know what we mean when you hear the words GET or POST
  • how to best manage a Url redirect
  • to know what is hiding behind a message "404 File not found" displayed by a browser
  • and much more...

To view more...

If this article has inspired you to search for more information about the HTTP protocol, here are some useful links:

Other Yakaferci articles in SEO and Technology section may also be helpful.