HTTP Headers

Common HTTP request and response headers.

Request Headers

Content-Type - Body format
Content-Type: application/json
Content-Type: application/x-www-form-urlencoded
Content-Type: multipart/form-data

Accept - Desired response format
Accept: application/json
Accept: text/html

Authorization - Authentication
Authorization: Bearer token123
Authorization: Basic dXNlcjpwYXNz

User-Agent - Client info
User-Agent: Mozilla/5.0 (Windows NT 10.0)

Response Headers

Content-Type - Response format
Content-Type: application/json; charset=utf-8

Content-Length - Body size in bytes
Content-Length: 348

Cache-Control - Caching directives
Cache-Control: no-cache
Cache-Control: max-age=3600
Cache-Control: public, must-revalidate

Location - Redirect URL
Location: https://example.com/new-url

Set-Cookie - Set cookie
Set-Cookie: sessionId=abc123; HttpOnly; Secure

CORS Headers

Access-Control-Allow-Origin
Access-Control-Allow-Origin: *
Access-Control-Allow-Origin: https://example.com

Access-Control-Allow-Methods
Access-Control-Allow-Methods: GET, POST, PUT, DELETE

Access-Control-Allow-Headers
Access-Control-Allow-Headers: Content-Type, Authorization

Access-Control-Allow-Credentials
Access-Control-Allow-Credentials: true

Custom Headers

Custom request headers
X-API-Key: your-api-key
X-Request-ID: abc-123-xyz

Custom response headers
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-Response-Time: 245ms