cURL
Headers Commands
Control HTTP headers for content negotiation, caching, CORS debugging, and custom API requirements. Headers are essential for proper API communication and debugging.
7 commands
Pro Tips
Use 'curl -I url' to fetch only response headers (HEAD request) — great for checking redirects and caching.
Chain multiple headers: 'curl -H "Accept: application/json" -H "X-API-Key: key" url'.
Use 'curl -D - url' to dump response headers alongside the body for debugging.
Common Mistakes
Some servers reject requests without a proper User-Agent header. Add '-A "MyApp/1.0"' if you get 403 errors.
Setting 'Content-Length' manually can cause issues. Let cURL calculate it automatically from your data.