We Ignore Your Accept-Encoding q= Weights and Serve Better Compression Anyway
·7 mins
Serving compressed HTTP responses correctly is more nuanced than calling gzip.compress(). This post walks through the CompressionMiddleware in Sylvan Librarian: Accept-Encoding negotiation, server-side algorithm priority, two distinct code paths for buffered versus streaming responses, the 200-byte skip threshold, Vary headers, and gzip mtime=0 for byte-identical repeated responses.