Display or list web server headers

by on August 16, 2007 · 1 comment· LAST UPDATED August 16, 2007

in , ,

If you are looking to debug a problem with HTTP server and would like to see HTTP requests / header responses in raw format, use shell tools or Firefox extensions.

Why do I need to dig out web server headers?

[a] Help debugging web application.

[b] See which kind of web server the remote site is using.

[c] See the cookies sent by remote site

[d] Learn http protocol and much more

Let us see Linux / UNIX command line tools to dig out headers.

wget command

wget command is not just downloading utility. It can be served as debugging tool. You need to pass -S option to wget command, which will print the headers sent by HTTP servers and responses sent by FTP servers.
$ wget -S http://theos.in
Output:

--01:32:15--  http://theos.in/
           => `index.html'
Resolving theos.in... 74.86.49.131
Connecting to theos.in|74.86.49.131|:80... connected.
HTTP request sent, awaiting response...
  HTTP/1.0 200 OK
  Connection: close
  X-Pingback: http://theos.in/xmlrpc.php
  Content-Type: text/html; charset="UTF-8"
  Date: Thu, 16 Aug 2007 20:02:16 GMT
  Server: lighttpd
Length: unspecified [text/html]
    [     <=>                                                                                                                              ] 44,214        32.56K/s
01:32:17 (32.50 KB/s) - `index.html' saved [44214]

If you are just intrested in headers pass --spider option to wget. With this option wget behave as a Web spider, which means that it will not download the pages, just check that they are there.
$ wget -S --spider http://theos.in/

Other command line tools

UNIX / Linux offers so many options. You can try out old good telnet command, lynx browser, curl command and other tools:
$ lynx -head -dump http://theos.in/
$ curl -I http://theos.in/

You can use telnet as follows:
$ telnet theos.in 80
Output:

HEAD /index.php HTTP/1.1

Firefox extension

If you are using Windows or just wanted to get information on fly, try firefox extension - LiveHTTPHeaders. It adds a 'Headers' tab in 'View Page Info' of a web page. You can also see a tool in the 'Tools->Web Development' menu to be able to display http headers in real time while pages are being downloaded from the Internet or web server. It also allows you edit request headers and replay an URL (good for testing web app security).

Download LiveHTTPHeaders

=> Visit project download page here

Other options

You can use specialized tools such as WireShark network protocol analyzer or tcpdump for the same purpose.

TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 1 comment… read it below or add one }

1 Rishiraj Singh September 7, 2007 at 1:58 pm

I want to design a tool using php that can allow anyone to check any website’s server information like hosting server, ip address and other thing from server header. I haven’t worked on Linux though, can you help me in that?

Reply

Leave a Comment

Tagged as: , , , , , , , ,

Previous post:

Next post: