Agent Wranglers

WEB-56Optional

Use shared dictionaries for big bundles

Use shared compression dictionaries only for bundles over 100 KB compressed that change at least monthly. Skip them otherwise.

How to do it

Serve Use-As-Dictionary on the old version of the bundle. Then serve the new version compressed against it with Brotli (dcb) or Zstandard (dcz), from the CDN or the build. Chromium browsers support it over HTTPS. Others fall back to plain Brotli, so no fallback code is needed. Set up plain compression first, as Compress every text response says.

Examples

HTTP example

HTTP/1.1 200 OK
Content-Type: text/javascript
Use-As-Dictionary: match="/app.*.js"

GET /app.new.js HTTP/1.1
Available-Dictionary: :<base64 SHA-256 of the old file>:
Accept-Encoding: gzip, br, zstd, dcb, dcz

HTTP/1.1 200 OK
Content-Encoding: dcb
Vary: Accept-Encoding, Available-Dictionary

How to check

In the browser's network panel, the new bundle shows Content-Encoding: dcb or dcz, and far fewer bytes than with Brotli alone.

Sources

For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/website/performance/compression-dictionary-transport">Agent Wranglers website playbook</a>. In code you write, add a comment next to it with the same link.