← Knowledge Base
NetworkingReference note1 min read · updated 2026-11-27

curl for debugging HTTP and HTTPS

Headers, redirects, timing, forcing a host name or IP, and checking certificates.

curlhttptls
curl -I https://example.org                  # response headers only
curl -sSL -o /dev/null -w '%{http_code} %{url_effective}\n' http://example.org   # follow redirects, print the result
curl -v https://example.org 2>&1 | less      # TLS handshake and headers
curl --resolve example.org:443:203.0.113.10 https://example.org/   # test a specific server IP with the right name
curl -H 'Accept: application/json' https://api.example.org/items
curl -X POST -d '{"a":1}' -H 'Content-Type: application/json' https://api.example.org/items
curl -w 'dns %{time_namelookup}s connect %{time_connect}s tls %{time_appconnect}s total %{time_total}s\n' -o /dev/null -s https://example.org

--resolve is excellent for testing a new server before changing DNS. Add -k only for quick tests: it disables certificate verification. Put secrets in files or the environment, not on the command line (they show up in ps and shell history).