Web Diagnostics
HTTP Headers for APIs: Content-Type, Authorization, Cache-Control, and More
Understand common API request and response headers, how Content-Type and Authorization differ, how caching affects APIs, and which headers to inspect during debugging.
In this article
HTTP Headers for APIs: Content-Type, Authorization, Cache-Control, and More
HTTP headers carry metadata about requests and responses.
Duck Cloud's HTTP Header Checker inspects public response headers.
Content-Type
Content-Type describes the response body.
A JSON API commonly returns:
Content-Type: application/jsonIf a client expects JSON but gets text/html, it may have received a login page, proxy error, or framework error page.
Accept
Accept describes response formats the client prefers.
Do not confuse it with Content-Type.
Authorization
APIs often use the Authorization header for bearer tokens or other credentials.
Never log live access tokens.
Cache-Control
Cache-Control affects how responses may be cached. Authentication-sensitive responses require careful caching rules.
Location
Redirect responses often use Location. Use Redirect Checker to trace multiple hops.
Retry-After
A service may provide Retry-After with rate limiting or temporary unavailability.
Use HTTP Status Code Lookup when interpreting status codes such as 429.
CORS
Browser JavaScript may be blocked by CORS even when curl or Postman works. Inspect relevant response headers and configure allowed origins deliberately.
Debugging workflow
- Record status code.
- Inspect
Content-Type. - Check redirects.
- Verify auth scheme.
- Review cache headers.
- Check CORS for browser-only failures.
- Preserve the raw response.
- Use request IDs with server logs.
Headers often reveal the failing layer before you even inspect the body.