The latest Chrome and Chromium seems to unpack .tar.gz files automatically for me on OS X and Linux. When using wget with the same URL, it shows:

$ wget http://mydomain/dir/file.tar.gz
...
HTTP request sent, awaiting response... 200 OK
Length: ... [application/octet-stream]
...

Verifying the file type:

$ file file.tar.gz
file.tar.gz: gzip compressed data, from FAT filesystem (MS-DOS, OS/2, NT)

When doing the same for the file downloaded with Chrome or Chromium:

$ file file.tar.gz
file.tar.gz: POSIX tar archive

Note, that Chrome/Chromium obviously kept the file name, but expanded it (the file size is ~4 times bigger than from the wget-downloaded file).

As website administrator how can I prevent Chrome/Chromium from unpacking the file?

Update:

According to curl -I http://mydomain/dir/file.tar.gz our Apache/Tomcat combo responds with

Content-Encoding: x-gzip

Tried .tar.gz files from other websites are not unpacked by chrome and don't report the Content-Encoding: x-gzip header, so there seems to be a relation.


Your web server is likely sending the .tar.gz file with a content-encoding: gzip header, causing the web browser to assume a gzip layer was applied only to save bandwidth, and what you really intended to send was the .tar archive. Chrome un-gzips it on the other side like it would with any other file (.html, .js, .css, etc.) that it receives gzipped (it dutifully doesn't modify the filename though).

To fix this, make sure your web server serves .tar.gz files without the content-encoding: gzip header.

More Info: https://code.google.com/p/chromium/issues/detail?id=83292