HTTP Common Errors and Debugging

Common HTTP status code comparisons, cURL debugging recipes, and troubleshooting patterns.

View
StandardDetailedCompact
Export
Copy the compact sheet, download it, or print it.
Download
`D` dense toggle · `C` copy all
## cURL Debugging Patterns
Print only the status code
curl -s -o /dev/null -w '%{http_code}
' https://example.com/health

# Useful for scripts and health checks.

Print redirect target
curl -s -o /dev/null -D - https://example.com | grep -i '^location:'

# Show the redirect location without fully following it.

Show timing data
curl -s -o /dev/null -w 'code=%{http_code} time=%{time_total}
' https://example.com

# Inspect total time and status code together.

Send JSON and inspect response
curl -i -X POST https://example.com/api/users -H 'Content-Type: application/json' -d '{"name":"Ada"}'

# Test common API validation and auth failures.

## Common Web Error Scenarios
401 vs 403
401 = not authenticated / invalid credentials
403 = authenticated but forbidden

# Authentication versus authorization.

404 vs 410
404 = not found
410 = gone permanently

# Missing resource versus intentionally removed resource.

301 vs 302 vs 307 vs 308
301 = permanent
302 = temporary
307 = temporary, preserve method
308 = permanent, preserve method

# Choose the right redirect semantics.

502 vs 503 vs 504
502 = bad upstream response
503 = service unavailable / overloaded / maintenance
504 = upstream timeout

# Gateway and availability failures.

Cache validation codes
304 Not Modified
412 Precondition Failed

# Conditional request and cache-related statuses.

Recommended next

No recommendations yet.