Apache – why it may serve Office documents as .zip files
Why does my web server rename a .xlsx file to .zip?
A friend called me with a trivial problem he was having on his web server. He wanted to offer a excel document for download and some of his users pointed out that the document's file name extension was always changed to .ZIP when they were downloading the file. He did some research and found out that it was browser dependent. Firefox did save it as .xlsx while IE and Opera did not.
MIME Types
I instantly knew that this was a mime type problem. A Office .xslx or .docx document IS actually a .zip archive that holds a number of files, according to the OpenXML specification. Web servers like Apache have some magic implemented to determine the mime type when no one had been set for a given file name extension. Because of this, the server identifies the document as a .zip file, because the configuration did not tell it about the existence of Office file formats (technically, this is perfectly ok, but it is not what the user expects) and returns it as .zip archive.
