Tips / Nginx

How to check HTTP Headers

This is not rocket science, but there are a few tips that may save you time if you need to gather information from the http headers. In this post I will show you 3 ways to get the web server headers of any site.  But first, it’s always good to know what are the http headers.

What are HTTP Headers?

HTTP means “Hypertext Transfer Protocol”, all the websites in the world are using this protocol since the early 1990′s. It has been one of the most used internet protocols and almost everything you see in your web browser is transmitted to your PC over HTTP. Every time you open your browser probably have sent and recieved lot of HTTP requests. The http headers are part of the core of these HTTP requests, and they storage information about the client browser, the web server you are using, the page you requested, and much more.

How can I see the HTTP Headers?

Using a webpage: you can use for example and it will provide an easy/fast interface to check out the headers of any web page. On this example I checked out and this was the result:

Status: HTTP/1.1 301 Moved Permanently
Date:Fri, 17 Jan 2014 08:54:20 GMT
Content-Type:text/html; charset=UTF-8

Using a browser plugin: for Chrome you can use HTTP Headers and for Firefox you can choose Live HTTP Headers.

http headershttp headersUsing the Linux shell: this is my favourite method as it doesn’t require any additional software, it’s fast and works on every system that has curl installed. I’m talking about fetching the headers using curl -I. Live example:

[webtech@localhost ~]$ curl -I
HTTP/1.1 200 OK
Server: nginx
Date: Fri, 17 Jan 2014 08:43:44 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
Last-Modified: Fri, 17 Jan 2014 08:38:45 GMT

HTTP Headers explained

On the last example (the one using curl) we got a few fields from the result, let me give you a brief explanation of each one of them:

  1. HTTP/1.1 200 OK: the http protocol version and the requst result number you got: 200 means the request was ok and you found a valid response from the web server.
  2. Server: this shows you the web server name you are running in your system.
  3. Date: the exact date and time when you did the http headers check.
  4. Content-Type: the MIME type of the body of the request (used with POST and PUT requests).
  5. Connection: the type of connection that is serving your request from the web server.
  6. Last-Modified: last modified date for the requested object
  7. Vary: specifies to downstream proxies how they should match future request headers in order to decide whether the cached response can be used rather than requesting a fresh one from the origin server.
  8. X-Pingback: the assigned value is an url that allows other sites to track linking between sites.

That’s all! Now you know more about the http headers and three easy ways to check for them.

Popular search terms:

  • check server headers
  • nginx check header
  • nginx print all headers
  • check http headers

Esteban Borges

Linux Geek, Webperf Addict, Nginx Fan. CTO @Infranetworking