Blog

Accept-Encoding, Brotli, gzip, and how CORS preflight caching interacts with Vary

OPTIONS responses may be tiny but still participate in cache keying when Vary lists Accept-Encoding alongside Origin.

1 min read
compressioncachingcors

Header coupling

If your API varies on encoding, ensure OPTIONS returns consistent Vary headers across all status codes.

Brotli-only clients should not receive stale gzip variants from shared caches.

Operational checks

Compare byte hit ratio before and after enabling compression on JSON payloads.

Monitor CPU on edge workers that compress on the fly during traffic spikes.

Back to blog