Apache server causes tar.gz files to download as uncompressed tarballs still named .gz

apache-2.2gziptar

We are hosting a number of .tar.gz files on our Apache server. When we download these files, the filename of the downloaded file is the same as on the server… something.tar.gz… but the file is actually an uncompressed tarball (as if just a .tar).

The response headers include

Content-Type: application/x-gzip
Content-Encoding: x-gzip

What Apache configuration can be used to cause these files to be downloaded as gzipped tarballs still named .tar.gz?

Best Answer

I had to add the following directive to get intentionally gzipped files to download without silently decompressing:

AddEncoding x-identity .tar.gz .gz .tgz