I’m attempting to GET a PDF file via Mongrel in my development
environment, and instead of returning a PDF file, I see it rendered as
text (%PDF-1.5 …etc.) in my browser window.
I was aware that Mongrel has a fairly limited set of mime-types that are
handled by default, so I went ahead and attempted to add the PDF
mime-type to the Mongrel handler.rb, like so:
“.pdf” => “application/pdf”
After I reboot, I still get the junk and not the PDF. My browser has no
problems opening PDF files.
ideally, when you switch to a production environment, you’ll have
apache serving these pdf files directly, but until then, you can use
the method above.
ideally, when you switch to a production environment, you’ll have
apache serving these pdf files directly, but until then, you can use
the method above.
Mike
That seems to work. I’m starting mongrel from within RadRails. Do you
know:
how to tell mongrel to listen on a particular port using the command
line above?
I just realized that there is something else I’m not understanding here.
I am able to successfully serve Word docs from my Mongrel server, but I
don’t have an entry for the Word mime type in handlers.rb.
How is it that my Word docs. are being transferred correctly to the
browser when requested from Mongrel? Is that because the browser is
detecting that the incoming stream is actually a Word doc. (ie. all of
the MIME type handling is happening on the client)?
I just realized that there is something else I’m not understanding here.
I am able to successfully serve Word docs from my Mongrel server, but I
don’t have an entry for the Word mime type in handlers.rb.
How is it that my Word docs. are being transferred correctly to the
browser when requested from Mongrel? Is that because the browser is
detecting that the incoming stream is actually a Word doc. (ie. all of
the MIME type handling is happening on the client)?
Probably because Microsoft makes sure that all their products work
together on another plane of existence. You should read about the crap
IE does so that it works faster with IIS and slower with other servers,
AND at the TCP/IP level no less.