I'm struggling to get apache2 to serve a file with the correct mime type. I'm using an installation of apache 2.2 installed with apt-get on Ubuntu.
The file in question is a maven repository file called maven-metadata.xml.md5
.
For some reason apache is insisting this is of type Content-Type: application/xml
This is clearly incorrect since the entire content of the file:
443219553065c4885947185d40d2a04e
I can only assume this decision is being made by apache because of "xml" in the file name, but it makes no sense in context.
I've tried adding md5
to /etc/mime.types
as text/plain
but I still get the same result.
The full headers are:
HTTP/1.1 200 OK
Date: Fri, 19 Dec 2014 22:58:30 GMT
Server: Apache/2
Last-Modified: Thu, 18 Dec 2014 14:56:57 GMT
ETag: "6e8e3cb-20-50a7ecdb68040"
Accept-Ranges: bytes
Content-Length: 32
Keep-Alive: timeout=30
Connection: Keep-Alive
Content-Type: application/xml
Any suggestions?
Edit I think I may have missed an obvious step like restarting the server after adding md5
to /etc/mime.types
.
Thanks to DerfK for pointing me to the right page:
It turns out this Apache is acting exactly as designed. It allows for multiple extensions and simply picks the right most extension that it recognises.
This can be read about here: http://httpd.apache.org/docs/current/mod/mod_mime.html#multipleext
The solution was to add
md5
againsttext/plain
in/etc/mime.types
. Then restart apache so that it recognises the change.