read
HTTP HEAD
Identical to GET but the server must not return a message body in the response. Used to inspect headers - size, type, last-modified - without downloading the payload.
HEAD /path HTTP/1.1 Properties
| Property | Value / Meaning |
|---|---|
| Safe | Yes - HEAD has no side effects, just like GET. |
| Idempotent | Yes - repeated HEAD requests yield the same headers. |
| Cacheable | Yes - HEAD responses can update cached entries for the same URL. |
| Has body | No - HEAD requests never carry a request body. |
| Body in response | No - the server sends headers only; any body is stripped. |
Examples
curl -I https://example.com/large.zip Check Content-Length and Content-Type before downloading.
curl --head https://example.com/ Same as -I; shows response status line and headers only.
curl -I -H 'If-Modified-Since: Wed, 01 Jan 2025 00:00:00 GMT' https://example.com/ Cheap freshness check without pulling the body.
HEAD /file.pdf HTTP/1.1\nHost: cdn.example.com Raw request to probe a resource's metadata.
Gotcha
Some CDNs and misbehaving servers return a body on HEAD or wrong Content-Length - always verify. curl -I on some servers switches to HEAD silently even against endpoints that only accept GET.
Related methods
HTTP GET
Requests a representation of the specified resource. It is the most common HTTP method and should have no side effects on the server.
HTTP OPTIONS
Asks the server which communication options (methods, headers, CORS rules) are available for the target resource. Widely used by browsers as the CORS preflight before non-simple cross-origin requests.