Skip to content

Did you know?

curl -I fetches only the response headers of a URL.

Great for checking redirects, caching and status codes without downloading the page.

Explained

To check what a web server sends back, you rarely need the whole page. curl -I sends a HEAD request and prints the status line and headers:

curl -I https://example.com
HTTP/2 200
content-type: text/html; charset=UTF-8
cache-control: max-age=3600
server: nginx

Useful combinations:

  • curl -IL http://example.com follows redirects and shows the headers of every hop, which makes redirect chains and HTTP-to-HTTPS rules easy to debug.
  • curl -I -H "Accept-Encoding: gzip" URL checks whether compression is enabled.
  • curl -I --resolve example.com:443:203.0.113.10 https://example.com tests a new server before you change DNS.

Some applications answer HEAD requests differently from GET, or not at all. In that case, make a normal request but print only the headers:

curl -s -D - -o /dev/null https://example.com

Learn more

← All tech tips · Suggest a fix

Back to top