Forcing apache to send correct Content-Type for docx files

apache-2.2mime

This seems to be an old problem: Users retrieving docx files from apache are receiving them with a Content-Type header which claims they're zip archives.

After a good deal of searching for solutions I have:

  • Added AddType application/vnd.openxmlformats-officedocument.wordprocessingml.document docx to my mod_mime config, as suggested in one of the top answers to Why are docx, xlsx, pptx downloading from webserver as zip files?

  • Verified that /etc/mime.types contains application/vnd.openxmlformats-officedocument.wordprocessingml.document docx (I didn't add it, it was already there), as suggested by the other top answer to that question

  • Added multiple directives to /etc/magic, which have had the net effect that file now recognizes docx correctly instead of calling it "Zip archive data, at least v2.0 to extract"

Despite all these things, apache continues to send docx files with a Content-Type: application/zip; charset=UTF-8 header.

The running apache is version Apache/2.2.16 (Debian) under Debian squeeze.

What else might I need to do to get docx to be sent with the correct Content-Type?

Best Answer

Problem identified and resolved. The files in question were being downloaded via a custom application which sets its own Content-Type headers.