This question about Configuration: Answered

Firefox does not recognize mime type of pdf documents

Firefox does not recognize the correct mime type of pdf documents in my wiki. Not only my Firefox. The Firefox of my colleagues as well. And it is not a general Firefox-PDF-issue. When I open other web pages with PDFs on them, they are being handled correctly. Just not on my foswiki site.

PDFs are displayed as Code, as plain text.

When I open the same foswiki pages or document attachments with the Internet Explorer, they look OK. Pdfs can be clicked or happily appear inside of their iframes.

My Foswiki installation is sitting on a debian server with a standard apache installation.

I'm using ssl (self signed key) and LDAP authentification via Apache, and that's all that is special about my configuration.

Symbolic links to mime.load and mime.conf are sitting in my mods-enabled directory, /etc/mime.types contains an entry for pdf files and is being used in mime.conf like this:
TypesConfig /etc/mime.types

Also, I tried to add a mime type for pdf manually in my VirtualHost section:
AddType application/pdf .pdf

Still, firefox displays garbage instead of PDFs. What did I miss out?

-- BirgitNietsch - 26 Nov 2015

EDIT: I tried to debug the transfer. This is what I got:

My Request:
$ openssl s_client -connect localhost:443
GET /pub/path/to/file.pdf HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:9.0) Gecko/20111220 Firefox/9.0
Connection: keep-alive
Cache-Control: max-age=0
Connection: keep-alive

The Answer:
HTTP/1.1 302 Found
Date: Thu, 26 Nov 2015 12:56:31 GMT
Server: Apache/2.2.22 (Debian)
Set-Cookie: SFOSWIKISID=myveryverylongcookieID; path=/; secure; HttpOnly
Location: https://myservername/bin/viewfileauth/path/to/file.pdf
Vary: Accept-Encoding
Content-Length: 0
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=iso-8859-15

closed

Narf. OK, got it. Somehow, I don't know why and how, the data/mime.types file got garbled. Completely. It looked like the source of a normal foswiki topic file. I can't remember ever touching this file in any way.

I found a suitable file on github and copied the contents from there: https://github.com/SvenDowideit/foswiki-plack-hack/blob/master/foswiki/data/mime.types

Problem solved.

-- BirgitNietsch - 26 Nov 2015

The latest version of that file is here: https://github.com/foswiki/distro/blob/master/core/data/mime.types

The version shipped with 1.1.10: https://github.com/foswiki/distro/blob/Release01x01/core/data/mime.types

-- GeorgeClark - 26 Nov 2015

Thank you! smile

-- BirgitNietsch - 26 Nov 2015
 

QuestionForm edit

Subject Configuration
Extension
Version Foswiki 1.1.9
Status Answered
Related Topics
Topic revision: r4 - 26 Nov 2015, BirgitNietsch
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy