Call: (480) 382-8464

Use Curl to See HTTP Headers

You can use curl to see the http headers from an email link, or webpage is going to send you to a known bad page. If you want to see the contents of the page, without risk of infection (look for base64 encoding is a good sign of an infected page, but common sense will prevail) – just curl the http://address without parameters. But if you want to get the headers from an http request using curl instead of your browser – perhaps to troubleshoot http response codes, ssl certificates or other website problems, then this is a technique that will help you…

see http headers using curl

  • 1. Standard in Linux, or Install and curl (cygwin has most of the unix binaries available to run on windows, and is free)
  • 2. Use “Curl” as explained below

Examples of Using CURL to See HTTP Headers

Example of looking at “proxy”, but it could be any url you are unsure about:

$ curl -sI http://proxy/
HTTP/1.1 302 Found
Location: http://proxy/?cfru=aHR0cDovL3Byb3h5Lw
Cache-Control: no-cache
Pragma: no-cache
Content-Type: text/html; charset=utf-8
Proxy-Connection: close
Connection: close
Content-Length: 1097

http://proxy does a temp redirect (302) in this example to: http://proxy/?cfru=aHR0cDovL3Byb3h5Lw
1097 Bytes are sent and there are no cookies dropped.

The following example is a program I wrote to manage shortcuts for myself, it uses easy mnemonics on to help me remember complicated or fre URLs. is a good example of a service that does this too. This curl http header example shows how to go through a local proxy to see what the redirector service is doing:

$ curl -x proxy:80 -U james -Is
Enter proxy password for user 'james':
HTTP/1.1 302 Found
Date: Thu, 30 Sep 2010 23:14:45 GMT
Server: Apache
Content-Type: application/octet-stream
Proxy-Connection: Keep-Alive
Connection: Keep-Alive

curl http headers are saying that goes directly to the google keyword tool link as a 302.

standard 301 redirect looks like…

$ curl -x proxy:80 -U james
Enter proxy password for user 'james':
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<H1>301 Moved</H1>
The document has moved
<A HREF="">here</A>.

Same 301 redirect url, but header instead of content

$ curl -x proxy:80 -U james -Is
Enter proxy password for user 'james':
HTTP/1.1 301 Moved Permanently
Content-Type: text/html; charset=UTF-8
Date: Thu, 30 Sep 2010 23:20:20 GMT
Expires: Sat, 30 Oct 2010 23:20:20 GMT
Cache-Control: public, max-age=2592000
Server: gws
X-XSS-Protection: 1; mode=block
Content-Length: 219
Proxy-Connection: Keep-Alive
Connection: Keep-Alive

Curl can be used for many reasons – and curl is much more than what I’m showing here too.

Showing http headers with curl is simply one good use that helps you to investigate questionable emails from Aunt Mildred about “click here for your virtual card shorturl.go/1771 ” type stuff. Or “you HAVE to watch this movie:

Normally you’d either delete the email, or take a chance and hope you don’t get infected… now you don’t have to guess. You can see what the actual content is going to be before you click it and load up the infections because you can see the http headers using curl.

wget can be used in a similar fashion, however – this article is about using curl to get http headers!

Leave a Reply

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

Main Offers/Services

Hosting and website related services offered by Digital Crunch:

Managed VPS Hosting

Server Updates, Module/Software Installs, Firewall, Security, Hosting Management, Wordpress - let us manage it for you

Hosted Email

Setup and Maintain Business Class, Secure Email Hosting including spam protection and 25GB of storage space

Linux Consulting

Server Updates, Module/Software Installs, Firewall, Security, Hosting, Wordpress and Apps, anything related to Linux

Email Marketing Services

We broadcast your content to your list, capture leads for you, follow up on schedules, make more sales for you

Website Maintenance

Content updates, menu changes, graphics changes, adding content, getting links, building traffic, building sales funnels

Hosting Tutorials

Tutorials we've written for other customers that like to get their hands dirty and learn about hosting