Apache2 MIME types for js and xml

apache-2.2mime

Would there be any functionality/serving problems on an Apache2 by changing the following default MIME types…

.js  : application/x-javascript
.xml : application/xml

To this…

.js  : text/javascript
.xml : text/xml

My testing seems to show it will work, but I don't fully understand the purpose of MIME types as they relate to serving files.

Best Answer

You need to be careful with mime types as they're sent to the browser to help them interpret what way to render certain files.

Changing these two particular MIME types shouldn't hurt, but I'd be very wary of doing this in general. The mime type is sent with the headers for that particular file and changing those may result in unexpected behaviour with certain clients.

i.e. you can't really tell what will happen by changing mime types as such, as that's client specific. You'd need someone with experience of all the various web browsers to tell you in this case, or you'd need to go test it yourself. In general, that's what you'd need to be careful of.