Cheatsheets
HTTP headers
HTTP request & response headers for caching, security, and CORS.
33 entries
Request9
Authorization: Bearer <token>Credentials (Bearer, Basic, …)
Accept: application/jsonMedia types the client can handle
Accept-Encoding: gzip, brCompression the client supports
Accept-Language: en, th;q=0.9Preferred languages (with weights)
Content-Type: application/jsonMedia type of the request body
Cookie: a=1; b=2Stored cookies sent back to the server
If-None-Match: "<etag>"Conditional request using an ETag
Range: bytes=0-1023Request part of a resource
X-Forwarded-For: <client-ip>Original client IP through proxies
Response7
Content-Type: text/html; charset=utf-8Media type of the body
Content-Length: 1234Body size in bytes
Location: /new-pathTarget URL for redirects / created resources
Set-Cookie: a=1; HttpOnly; SecureSend a cookie to the client
ETag: "abc123"Version identifier for caching
Retry-After: 120When to retry (429 / 503)
Content-Disposition: attachment; filename=x.csvForce a download
Caching6
Cache-Control: no-storeNever cache the response
Cache-Control: max-age=3600Fresh for 3600 seconds
Cache-Control: public / privateAny cache / browser only
Cache-Control: stale-while-revalidate=60Serve stale while refreshing
Age: 120Seconds the object has been cached
Vary: Accept-EncodingHeaders that affect the cached variant
Security6
Strict-Transport-Security: max-age=63072000Force HTTPS (HSTS)
Content-Security-Policy:
default-src 'self';
img-src *;
script-src 'self'Restrict allowed content sources
X-Content-Type-Options: nosniffDisable MIME sniffing
X-Frame-Options: DENYPrevent clickjacking via framing
Referrer-Policy: strict-originControl how much referrer is sent
Permissions-Policy: camera=()Disable browser features
CORS5
Access-Control-Allow-Origin: *Origins allowed to read the response
Access-Control-Allow-Methods: GET, POSTAllowed cross-origin methods
Access-Control-Allow-Headers: Content-TypeAllowed request headers
Access-Control-Allow-Credentials: trueAllow cookies cross-origin
Access-Control-Max-Age: 86400How long to cache the preflight