content
Accept-Encoding
Client advertisement of which content codings it can decode, letting the server compress the response accordingly. Absence means 'identity only'; an explicit identity;q=0 forbids uncompressed responses.
Accept-Encoding: <coding>[;q=<qvalue>][, <coding>...] (gzip, br, deflate, zstd, identity, *) Common directives / values
| Directive | Purpose |
|---|---|
| gzip | Universally supported. |
| br | Brotli — sent by modern browsers over HTTPS. |
| deflate | Legacy zlib deflate. |
| zstd | Zstandard — increasing modern browser support. |
| identity | No compression. |
| * | Any coding not explicitly listed. |
Examples
Accept-Encoding: gzip, deflate, br, zstd Typical modern browser advertisement.
Accept-Encoding: identity Force uncompressed — useful when debugging with tcpdump or curl.
Accept-Encoding: gzip;q=1.0, br;q=0.9, *;q=0 Explicit preference: gzip over brotli, forbid everything else.
curl -H 'Accept-Encoding: gzip' --compressed https://example.com Request gzip and auto-decompress with curl.
Gotcha
Servers must always add Vary: Accept-Encoding when responses differ by encoding — otherwise a CDN can hand a gzipped body to a client that didn't ask for one. 'identity;q=0, *;q=0' means the client accepts NOTHING and the server should return 406.
Related headers
Content-Encoding
Indicates that the body has been transformed with one or more compressions and must be decoded in reverse order to recover the original payload. Negotiated via the client's Accept-Encoding.
Vary
Tells caches which request headers were used for content negotiation, so they know to store and serve separate variants keyed by those headers. Missing or wrong Vary causes users to see cached content meant for someone else (wrong language, encoding, or device).
Content-Length
Number of octets in the message body, letting the recipient know exactly where the message ends. Required for most requests with bodies unless Transfer-Encoding: chunked is used.
Content-Type
Declares the media type of the body in both requests and responses, and often carries additional parameters like charset or boundary. Governs how the recipient parses or renders the payload.
Content-Disposition
In responses, controls whether the browser renders the body inline or offers it as a download, and suggests a filename. In multipart/form-data request parts, names the form field and optionally the upload filename.