How to check Apache HTTP Header information on Linux

By default, Apache send version and few modules details to header such as mod_php, mod_perl, mod_ssl with every http header. As a server administrator we should know about mod_header module because this will help us to identify and understand the header informations. Say for example, if we enabled any module behind or over the apache, we can check this on apache header information such as Varnish cache, CDN, mod_pagespeed, etc.., Here i’m showing few commands with different option to fetch the apache header information.

If you want to check/verify your http header request is “OK” or “NOT OK”, use the below commands to identify the error’s. wget command is not downloading utility. you can view the http header using wget command with passing -S

# wget -S https://www.2daygeek.com
--2013-11-26 08:54:09--  https://www.2daygeek.com
Resolving www.2daygeek.com... 109.123.85.74
Connecting to www.2daygeek.com|109.123.85.74|:80... connected.
HTTP request sent, awaiting response...
  HTTP/1.1 200 OK
  Date: Tue, 26 Nov 2013 08:54:09 GMT
  Server: Apache
  X-Powered-By: PHP/5.2.17
  Connection: close
  Content-Type: text/html
Length: unspecified [text/html]
Saving to: `index.html.1'

    [ <=>                                                                                                                          ] 17,220      --.-K/s   in 0s

2013-11-26 08:54:09 (179 MB/s) - `index.html.1' saved [17220]

You can add the –spider option with wget command to print the httpd header results.

# wget -S --spider https://www.2daygeek.com
Spider mode enabled. Check if remote file exists.
--2013-11-26 08:54:50--  https://www.2daygeek.com
Resolving www.2daygeek.com... 109.123.85.74
Connecting to www.2daygeek.com|109.123.85.74|:80... connected.
HTTP request sent, awaiting response...
  HTTP/1.1 200 OK
  Date: Tue, 26 Nov 2013 08:54:50 GMT
  Server: Apache
  X-Powered-By: PHP/5.2.17
  Keep-Alive: timeout=15
  Connection: Keep-Alive
  Content-Type: text/html
Length: unspecified [text/html]
Remote file exists and could contain further links,
but recursion is disabled -- not retrieving.

Lynx is a text based web browser, you can get the header output using lynx command.

# lynx -head -dump https://www.2daygeek.com
HTTP/1.1 200 OK
Date: Tue, 26 Nov 2013 08:55:23 GMT
Server: Apache
X-Powered-By: PHP/5.2.17
Connection: close
Content-Type: text/html

You can view the http header using curl.

# curl -I https://www.2daygeek.com
HTTP/1.1 200 OK
Date: Tue, 26 Nov 2013 08:55:50 GMT
Server: Apache
X-Powered-By: PHP/5.2.17
Content-Type: text/html

About Magesh Maruthamuthu

Love to play with all Linux distribution

View all posts by Magesh Maruthamuthu

One Comment on “How to check Apache HTTP Header information on Linux”

Leave a Reply

Your email address will not be published. Required fields are marked *