Skip to content
gohacks.dev
APIs

HTTP Headers Reference

A searchable reference of the HTTP request and response headers developers deal with: caching, CORS, cookies, security, proxies, content negotiation and tracing.

Free · No sign-up · Your inputs stay in your browser

Reference

HTTP headers reference

HeaderSent inWhat it does
AcceptRequestMedia types the client can handle, with q= weights.
Accept-EncodingRequestCompression the client supports: gzip, br, zstd.
Accept-LanguageRequestPreferred languages.
AuthorizationRequestCredentials: Bearer <token>, Basic <base64>. Never log it.
Cache-ControlBothCaching rules (RFC 9111). no-store, no-cache, max-age, s-maxage, private, immutable.
ConnectionBothHop-by-hop options; forbidden in HTTP/2 and HTTP/3.
Content-DispositionResponseinline or attachment; filename="...". Forces a download.
Content-EncodingResponseCompression applied to the body: gzip, br, zstd.
Content-LengthBothBody size in bytes.
Content-Security-PolicyResponseWhere scripts, styles and other resources may load from.
Content-TypeBothMedia type of the body, with charset for text.
CookieRequestCookies the browser sends back.
Set-CookieResponseStores a cookie: Secure, HttpOnly, SameSite, Path, Domain, Max-Age.
CF-Connecting-IPRequestThe client IP as seen by Cloudflare. Trust it only from Cloudflare's ranges.
DateResponseWhen the response was generated.
ETagResponseVersion identifier for conditional requests.
If-None-MatchRequestSends a stored ETag; a match gets 304 Not Modified.
If-Modified-SinceRequestConditional GET by date.
If-MatchRequestOnly proceed if the ETag matches: optimistic locking over HTTP (412 if not).
Last-ModifiedResponseWhen the resource last changed.
ExpiresResponseLegacy absolute expiry; Cache-Control max-age wins when both are present.
AgeResponseSeconds the response has spent in a shared cache.
VaryResponseRequest headers that change the response (Accept-Encoding, Origin). Caches key on them.
HostRequestTarget host and port; required in HTTP/1.1. :authority in HTTP/2.
LocationResponseRedirect target (3xx) or the created resource (201).
OriginRequestScheme, host and port of the page making a cross-origin or POST request.
RefererRequestThe page that linked here (misspelled in the original spec).
Referrer-PolicyResponseHow much of the URL goes in Referer.
User-AgentRequestClient software. Easily faked.
RangeRequestByte range for partial downloads and video seeking.
Content-RangeResponseWhich bytes a 206 response holds.
Accept-RangesResponsebytes if the server supports Range.
Retry-AfterResponseSeconds or a date to wait, with 429 and 503.
Strict-Transport-SecurityResponseHTTPS only for this host, for max-age seconds.
X-Content-Type-OptionsResponsenosniff: trust Content-Type, do not guess.
X-Frame-OptionsResponseDENY or SAMEORIGIN; superseded by CSP frame-ancestors.
Permissions-PolicyResponseWhich browser features (camera, geolocation) the page and its iframes may use.
Cross-Origin-Opener-PolicyResponseIsolates the browsing context from cross-origin popups.
Cross-Origin-Embedder-PolicyResponseWith COOP, enables cross-origin isolation (SharedArrayBuffer).
Cross-Origin-Resource-PolicyResponseWho may embed this resource.
Access-Control-Allow-OriginResponseCORS: which origin may read the response.
Access-Control-Allow-MethodsResponseCORS preflight: allowed methods.
Access-Control-Allow-HeadersResponseCORS preflight: allowed request headers.
Access-Control-Allow-CredentialsResponseCORS: allow cookies; cannot pair with origin *.
Access-Control-Max-AgeResponseSeconds a preflight result may be cached.
Access-Control-Request-MethodRequestSent in a preflight: the method the real request will use.
X-Forwarded-ForRequestClient IP chain added by proxies. Spoofable unless set by your own proxy.
X-Forwarded-ProtoRequestOriginal scheme (https) at the proxy. Laravel reads it through TrustProxies.
X-Forwarded-HostRequestOriginal Host at the proxy.
ForwardedRequestStandard form of the X-Forwarded-* headers (RFC 7239).
X-Request-IDBothCorrelation ID for tracing one request through logs. Convention, not a standard.
traceparentRequestW3C Trace Context: trace and span IDs for distributed tracing.
X-CSRF-TOKENRequestCSRF token; Laravel also reads X-XSRF-TOKEN from its cookie.
X-Requested-WithRequestXMLHttpRequest marks an AJAX request; Laravel's $request->ajax() reads it.
UpgradeRequestProtocol switch, e.g. websocket (HTTP/1.1).
Sec-WebSocket-KeyRequestWebSocket handshake nonce.
Sec-Fetch-SiteRequestsame-origin, same-site, cross-site or none: a cheap CSRF signal.
Sec-Fetch-ModeRequestnavigate, cors, no-cors, same-origin, websocket.
Sec-CH-UARequestUser-Agent client hint: brand and major version.
LinkResponsePreload hints and pagination links; sent early in a 103 response.
ServerResponseServer software. Hide the version (server_tokens off).
Server-TimingResponseBackend timings shown in DevTools: db;dur=53.
WWW-AuthenticateResponseHow to authenticate; required with 401.
AllowResponseMethods a resource supports; required with 405.
Transfer-EncodingResponsechunked in HTTP/1.1; not used in HTTP/2.
Alt-SvcResponseAdvertises HTTP/3: h3=":443".
Idempotency-KeyRequestMakes POST retries safe (Stripe and others). IETF draft.
PreferRequestClient preferences, e.g. return=minimal (RFC 7240).

Header names are case-insensitive, and HTTP/2 and HTTP/3 send them in lowercase. Semantics follow RFC 9110 and RFC 9111 unless another source is named. A header behind a proxy (X-Forwarded-*) is only as trustworthy as the proxy that set it.

The standards

HTTP semantics, including most of the headers here, are defined in RFC 9110, caching in RFC 9111, and cookies in RFC 6265. Security headers such as CSP and the CORS headers come from W3C and WHATWG specifications. Header names are case-insensitive, and HTTP/2 and HTTP/3 send them in lowercase.

Proxy headers

X-Forwarded-For, X-Forwarded-Proto and the standard Forwarded header carry the client's address and scheme past a proxy. They are only as trustworthy as the proxy that set them: a framework must be told which proxies to trust, or any client can claim any IP. In Laravel that is the trustProxies middleware setting.

Share

Frequently asked questions

Are HTTP header names case-sensitive?
No. Content-Type and content-type are the same header, and HTTP/2 requires lowercase on the wire.
What is the difference between X-Forwarded-For and X-Real-IP?
X-Forwarded-For is a list that each proxy appends to; X-Real-IP is a single address set by a proxy such as Nginx. Neither is standard; Forwarded (RFC 7239) is.
Is what I paste sent anywhere?
No. The tool runs entirely in your browser with JavaScript. Nothing you type or paste is sent to our server or stored.

Keep planning

Similar tools