Get MIME type of files served by Apache

apache-2.2mime

I use an Apache server to make available J2ME application files (namely a *.jad file and a *.jar archive).

Now I know that to properly serve these files you need to tell Apache what their MIME type is. I also know that you can do this via .htaccess files, Directory directive in Apache configuration files or in /etc/mimes.types with the following commands:

  • [AddType] text/vnd.sun.j2me.app-descriptor jad
  • [AddType] application/java-archive jar

I used all these ways but I still can't download the jad file with a mobile phone, instead it is displayed as a text file.

Now my question is : is it possible to know which MIME type is used when a file is downloaded ?

Therefore I am looking for a diagnosis tool (preferably serverside) that can tell me in details what happens for each file served by Apache.

Thank you very much for your help.

Best Answer

is it possible to know which MIME type is used when a file is downloaded

This should be the value of the Content-Type HTTP Header.

It should be possible to modify your Apache LogFormat line to include the value of the Content-Type Header. %{Content-Type}o.

If you are not serving content over HTTPS, then you could install and use wireshark. This probably wouldn't be as useful if you want to collect this for many requests over time.

Many browsers and http clients will give you this information. Check out liveheaders on firefox. Both wget and curl include verbose modes that will display the content-type and other headers.