[Mongrel] what should be correct .conf file for being served by apache for static content

Tom Brice tom at onidle.com
Sat Sep 9 16:06:45 EDT 2006

On 9/9/06 8:36 AM, Jens Kraemer  wrote:

> To conditionally forward requests to Mongrel you should use url
> rewrite rules instead of ProxyPass* directives:
> # 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
> # translated: "if this request does not point to a file we have lying
> # around in our file system (the !-f part), then go ahead and let
>  #Mongrel do it's job"
> RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_URI} [P,QSA,L]
> You can achieve the same with the Proxy* rules by explicitly excluding
> several directories where static files reside from being proxied, but
> the rewrite approach is much more elegant, imho.
> The snippet has been taken from the quite complex apache config example
> at http://mongrel.rubyforge.org/docs/apache.html

Just wanted to thank you for annotating this.  Very helpful to know how
these rules work.


More information about the Mongrel-users mailing list