Interview Prep/Networking/Command-Line Tools & Diagnostics

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.

All Networking questions Roadmap: Networking for DevOps

More on Command-Line Tools & Diagnostics