distgit: disable mod_mime_magic content encoding for archives

mod_deflate wasn't the issue, as src didn't have gzip enabled. The
backend (pkgs01) uses mod_mime_magic, which sniffs .crate files
and adds false gzip headers. Forcing application/octet-stream
fixes the client double-decompression bug.

Fixes #12812.

Signed-off-by: Victor Koycheff <victorkoycheff@gmail.com>
This commit is contained in:
Victor Koychev 2026-03-04 21:31:27 +02:00 committed by Kevin Fenzi
commit b935cd4d86

View file

@ -3,11 +3,16 @@ Alias /lookaside /srv/cache/lookaside
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
{% if env == 'staging' %}
# Disable global mod_deflate for lookaside cache
# to prevent double-compression and false gzip headers
SetEnv no-gzip 1
SetEnv dont-vary 1
# Disable mod_mime's automatic Content-Encoding for archives
RemoveEncoding .gz .tgz .bz2 .xz .zst .lzma .crate
# Force all lookaside files to be served as generic binary data.
# This prevents mod_mime_magic from sniffing .crate files and adding x-gzip encoding.
ForceType application/octet-stream
# Explicitly remove Content-Encoding just to be absolutely sure
Header unset Content-Encoding
{% endif %}
</Directory>