How do you use curl to debug an HTTP problem?
BeginnerConceptCommand-Line Tools & Diagnostics
Answer
curl -v https://example.com
curl -I https://example.com # headers only
curl -sS -o /dev/null -w "dns=%{time_namelookup} connect=%{time_connect} tls=%{time_appconnect} ttfb=%{time_starttransfer} total=%{time_total} code=%{http_code}\n" https://example.com
curl --resolve example.com:443:1.2.3.4 https://example.com
curl -k https://self-signed.local # skip verification (diagnosis only)
The -w timing breakdown shows whether delay is DNS, TCP, TLS or the application.
More on Command-Line Tools & Diagnostics
How do you check if a remote port is open?BeginnerHow do you list listening ports and the processes that own them?BeginnerWhat does `ping` tell you and what does it not?BeginnerHow does traceroute work and how do you read the output?BeginnerWhat is mtr and why is it better than traceroute?IntermediateHow do you query DNS with dig and read the answer?Beginner