HTTP Field Guide
A short reference for checking headers, redirects, and cache behavior on a static site.
Inspect response headers
Ask the server for headers without downloading the response body. Replace example.org with a host you administer.
curl --head https://example.org/
This sends a HEAD request. To inspect the headers of an ordinary GET response instead, use curl --dump-header - --output /dev/null https://example.org/ on a Unix-like system.
Read the status code
- 200 OK
- The request succeeded. A successful GET usually includes a response body.
- 204 No Content
- The request succeeded and the server sends no response body.
- 301 Moved Permanently / 308 Permanent Redirect
- Read the
Locationheader for the new URL. A 308 preserves the original method and body. - 304 Not Modified
- A conditional request confirmed that a stored response is still current. Reuse the stored body.
- 404 Not Found
- The server could not find a representation for the requested URL. Check the host, path, and letter case.
Check cache behavior
Cache-Control: max-age=300 permits a cache to treat the response as fresh for five minutes from its generation time. If a response has an Age header, that time has already been spent in caches.
An ETag labels a representation. Copy the label exactly, including any quotes, into an If-None-Match request header to check whether the representation has changed.