Hi. I'm having a problem that an Apache2 server is sending a content type of text/plain for a PDF document instead of application/pdf. Here is the setup - there are a number of Ruby on Rails applications running mongrel processes behind the Apache2 server. The PDF documents are in the Public folders of the RoR apps. When I try to access the PDFs from IE7 or Safari, they work fine. When I try to access from Firefox 2 or 3, they show up as plain text. Checking with curl -I confirms that the server is sending "text/plain" as the content type. There is already an "application/pdf pdf" entry in the conf/mime.types, and adding "AddType application/pdf .pdf" to conf/httpd.conf doesn't help. Also, there is an approval server running the same RoR apps in the same setup, and it serves the PDFs correctly (with an "application/pdf" content type). So, what do I need to change to make the server send application/pdf content type for PDFs? My experience with Apache is limited, and I didn't set these servers up, but if you need any more information I should be able to find out. Thanks for any help.
Hello Scott, I'm sorry but it has to be near impossible to get different results from Apache depending on what browser you are using. Have you tried multiple older and newer versions of FireFox? In all my time I have never heard of Apache doing such a action. What happens when you use wGet to grab the file on a Linux file system or similar?
Did you remember to restart Apache after modifying the mime types (or anything in httpd.conf)? Just need to check. Thanks, Jay
Its not that I'm getting different results from different browsers, Its sending the same content type to each browser, Firefox is just the only one that seems to care. I'm sorry, I didn't make that clear. Other browsers render fine. I have not tried wGet, but I have used curl to grab the file and check the message headers, which show the server sending a content type of text/plain. When using curl to get the same file, stored in the same application, on a different Apache2 server, it sends the correct content type. As far as the restart goes, we use webmin to manage our servers, and I use the "Apply Changes" function when I make changes (which I believe does a "graceful" restart, though I am not certain). I cannot completely shut down the server because it serves several production applications. Again, thanks for any help.
Also, just as a side note, I just tried adding in a call to my magic file, which has a line in it to identify PDFs by the first line in the file, but that didn't change anything either.