Stop letting curl hide the real reason your API requests are failing
Networking & Firewall (Ss/Netstat/Iptables/Nftables/Curl)
Stop letting curl hide the real reason your API requests are failing
🧩 The Challenge
Dealing with a production API that just returns a cryptic 403 or a silent timeout while you are testing with curl is enough to drive anyone insane. You get zero visibility into the TLS handshake or the specific headers that might be triggering a WAF block.
💡 The Fix
Start using the trace options to dump the actual wire traffic to a file so you can inspect the exact conversation between your client and the server. It strips away the mystery of why your request is getting rejected.
curl -v -o /dev/null --trace-ascii debug.txt https://your-api-endpoint.com
⚙️ Why It Works
Adding the trace-ascii flag forces curl to log every single byte sent and received, including those messy TLS negotiation details. Looking through that output file usually reveals the exact header or handshake stage that’s causing the problem.
🚀 Pro-Tip: Pipe that trace into less if the response is massive, or you’ll be scrolling for days.
Linux Tips & Tricks | © ngelinux.com | 8/19/2026
