[Mongrel] Telling Apache Not to Send a Sub-Directory to the Cluster

Jens Kraemer kraemer at webit.de
Sat Aug 12 05:17:16 EDT 2006


Hi!

On Thu, Aug 10, 2006 at 10:25:13AM -0700, HH wrote:
> Howdy,
> 
> I am using Apache 2.2 and Mongrel with great success.
> 
> I have a mod_rewrite question and I am NO expert. I think it's really simple
> but I haven't nailed it. I was hoping someone here could help.
> 
> I'm using Apache conf right out of the cluster example from the Mongrel
> site.

I couldn't find that, so I'm assuming your rewrite rules look like this:

RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteRule .* balancer://mongrel_cluster%{REQUEST_URI}  [P,QSA,L]

> I have a directory under my apps 'public' directory called 'sendto'. Files
> in that directory are accessible but I want to be able to provide a
> directory listing for when no specific file is requested.
>
> Right now, it seems that the requests to http://domain.com/sendto/ are being
> sent to the cluster.
> 
> I am looking for a rewrite statement that basically tells Apache not to send
> that specific URL pattern to the cluster.

to achiee this, just add another RewriteCond line:

RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/sendto
RewriteRule .* balancer://mongrel_cluster%{REQUEST_URI}  [P,QSA,L]

this excludes requests pointing to URIs starting with /sendto from being
sent via the balancer. Instead these requests will be served by Apache,
and directory listings can be allowed with something like

<Directory /path/to/public/sendto>
  Options Indexes
</Directory>


hth,
Jens


-- 
webit! Gesellschaft für neue Medien mbH          www.webit.de
Dipl.-Wirtschaftsingenieur Jens Krämer       kraemer at webit.de
Schnorrstraße 76                         Tel +49 351 46766  0
D-01069 Dresden                          Fax +49 351 46766 66


More information about the Mongrel-users mailing list