Sure, browsers work, but I think they're a bit overkill for this task. My favorite method is using the curl command line utility, which is available on almost all Unix-like systems. Use the -I
flag, which tells curl to make an HTTP HEAD request and print just the headers:
$> curl -I http://example.com/
HTTP/1.1 200 OK
Accept-Ranges: bytes
Cache-Control: max-age=604800
Content-Type: text/html
Date: Thu, 31 Oct 2013 15:49:18 GMT
Etag: "359670651"
Expires: Thu, 07 Nov 2013 15:49:18 GMT
Last-Modified: Fri, 09 Aug 2013 23:54:35 GMT
Server: ECS (sea/55ED)
X-Cache: HIT
x-ec-custom-error: 1
Content-Length: 1270
Note that using the -I
flag makes an HTTP HEAD request; the server should send you the same headers you would have received had you made an HTTP GET request, but a misconfigured or buggy one may not (I've only encountered this once). If you suspect that's the case, use the -i
flag (lowercase instead of uppercase), which will do a GET request and print the headers followed by the body of the response. You'll also need to use the -i
flag if you need to do another type of HTTP request, such as POST.