topic
Verified 2026-09-18

HTTP Compression

Content codings reduce the bytes sent over the network while keeping the selected representation identifiable.

Negotiate compression with Accept-Encoding and describe the applied coding with Content-Encoding. Compress text and structured data, but avoid compressing data that is already compressed.

httpperformancecontent-encoding

Reference (http)

Accept-Encoding: br, gzip
Content-Encoding: br
Vary: Accept-Encoding

Negotiate compression with Accept-Encoding and describe the applied coding with Content-Encoding. Compress text and structured data, but avoid compressing data that is already compressed.

Common mistakes

  • Compressing sensitive secrets together with attacker-controlled text, which can create side-channel risks.
Permalink: https://merginit.com/reference/http/compression