HTTP cheatsheet

HTTP: Inspect requests with curl

6 common HTTP tasks.

See response headers

Print the response headers along with the body.

curl -i https://example.com

See only the headers

Send a HEAD request and print the headers.

curl -I https://example.com

See the whole conversation

Print the request headers, response headers and TLS details.

curl -v https://example.com

Follow redirects

Follow Location headers and show each hop with -i.

curl -iL http://example.com

Print only the status code

Discard the body and print the HTTP status.

curl -s -o /dev/null -w "%{http_code}\n" https://example.com

Test conditional caching

Send an ETag and check for a 304 response.

curl -i -H 'If-None-Match: "33a64df551425fcc55e4d42a148795d9f25f89d4"' https://example.com/data.json

Was this page helpful?