[Solved] Incorrect content type for PDF file with Firefox


Had the same problem with a .svg file.

Solved it by modifying the Mozilla Firefox mimeTypes.rdf file in the profile folder. (thx to Piotrs Link above)

For other people having a similar problem. This was caused due to a mistakenly set Content-Type in my PHP script. When first testing the script (it delivered a svg file indirectly via php) i had another Content-Type set in the header().

header("Content-Type: image/svg+xml"); //should have been
header("Content-Type: application/vnd.android.package-archive"); //was actually set

This now overruled the content type setting in the firefox mimeTypes.rdf file:

  <RDF:Description RDF:about="urn:mimetype:application/vnd.android.package-archive"
                   NC:value="application/vnd.android.package-archive"
                   NC:editable="true"
                   NC:fileExtensions="svg"
                   NC:description="Scalable Vector Graphics">
    <NC:handlerProp RDF:resource="urn:mimetype:handler:application/vnd.android.package-archive"/>
  </RDF:Description>

Probably because FF thinks its seeing a “new” file/filetype – and adding it to its config.

To fix this, you only need to delete the wrong XML section in the mimeTypes.rdf and restart FF of course.

solved Incorrect content type for PDF file with Firefox