okay, I managed to solve the problem by creating a mime.types file with ".pdf: application/pdf" and referencing it using ":mime_map config/mime.types".  The problem is, this means that the pdf file is being served by mongrel, whereas it should be served as a static file via apache.  In my rewrite log, I see the following:

(3) applying pattern '^/$' to uri '/pdfs/instructions.pdf'
(3) applying pattern '^([^.]+)$' to uri '/pdfs/instructions.pdf'
(3) applying pattern '^/(.*)$' to uri '/pdfs/instructions.pdf'
(4) RewriteCond:
(3) input='/usr/local/www/data/vhosts/www.mydomain.com/current/public/pdfs/instructions.pdf'
(3) pattern='!-f' => not-matched
(1) pass through /pdfs/instructions.pdf    

and I'm using the following rewrite rules:

  # Rewrite index to check for static
  RewriteRule ^/$ /index.html [QSA]

  # Rewrite to check for Rails cached page
  RewriteRule ^([^.]+)$ $1.html [QSA]

  # Redirect all non-static requests to cluster
  RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
  RewriteRule ^/(.*)$ balancer://mls%{REQUEST_URI} [P,QSA,L]

so doesn't "pass through" mean that the file is being passed through to apache to be served statically?  I have sendfile installed, so does that mean that it's using sendfile to give apache a reference to the file, and so that may be why it's having trouble with mime type (since maybe apache doesn't use it's own mime type when being passed a reference via sendfile)?

I just want to make sure that I'm doing this the correct way and that my static files are being served statically.  Am I doing the right thing by adding the mime type to the mongrel mime_map file?  Thanks,

Mike

On 7/7/06, Mike Garey <[EMAIL PROTECTED]> wrote:
I'm using the instructions from http://blog.codahale.com/2006/06/19/time-for-a-grown-up-server-rails-mongrel-apache-capistrano-and-you/ to configure mongrel_cluster with apache mod_proxy_balancer.  Everything works fine, except when I try to link to a pdf file to be opened in a new window, it displays the contents of the pdf as text instead of opening it as a pdf document through Acrobat.  If I try adding a link to a pdf file in a regular html file (as in under ~/public_html) which is served directly by apache (and not by mongrel), it works properly.. I'm not sure exactly how to configure mongrel/apache to play nicely with pdf files.. Is this happening because I haven't told apache that pdf files are static content and should be handled by it rather than mongrel?  If anyone has any suggestions on how to get this to work, please let me know.  Thanks,

Mike

_______________________________________________
Mongrel-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/mongrel-users

Reply via email to