[Mongrel] Expert feedback needed

Jens Kraemer kraemer at webit.de
Mon Oct 2 04:52:53 EDT 2006


Hi!

On Mon, Oct 02, 2006 at 09:46:12AM +0300, 13 wrote:
[..]
> > >       RewriteEngine On
> > >
> > >       # Check for maintenance file. Let apache load it if it exists
> > >       RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
> > >       RewriteRule . /system/maintenance.html [L]
> > >
> > >       # Let apache serve static files
> > >       RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f
> > >       RewriteRule (.*) $1 [L]
> > >
> > >       # Don't do forward proxying
> > >       ProxyRequests Off
> > >
> > >       # Enable reverse proxying
> > >       <Proxy *>
> > >               Order deny,allow
> > >               Allow from all
> > >       </Proxy>
> > >
> > >       # Pass other requests to mongrel instance
> > >       ProxyPass / http://127.0.0.1:8200/
> > >       ProxyPassReverse / http://127.0.0.1:8200/

Are you sure this setup serves static files via Apache? Imho the
ProxyPass directives should be executed regardless of the outcome of
your rewriting, forwarding all requests to mongrel.

I usually use the rewriting the other way around, without any ProxyPass
directives:

    # Don't do forward proxying
    ProxyRequests Off

    # Enable reverse proxying
    <Proxy *>
      Order deny,allow
      Allow from all
    </Proxy>

    RewriteEngine On

    # Check for maintenance file. Let apache load it if it exists
    RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
    RewriteRule . /system/maintenance.html [L]

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

    # Let apache serve static files (send everything via mod_proxy that
    # is *no* static file (!-f)
    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
    RewriteRule .* http://127.0.0.1:8200%{REQUEST_URI} [L,P,QSA]


the P option to the last rule replaces the ProxyPass and
ProxyPassReverse directives.

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