[Mongrel] #17446 [PATCH] Add option to mongrel_rails to force mongrel not to serve static files
Will Green
will at hotgazpacho.com
Fri Jan 25 09:32:55 EST 2008
SO, it sounds like you have Apache (or another web server) in front of a pack of Mongrels, which should be serving static files. It sounds like your front-end web server is passing requests back to mongrel when this is not your intent. If so, it sounds like you have a misconfiguration in your front-end web server configuration.
Is this the case?
==
Will Green
Saimon Moore wrote ..
> Hi Nathan,
>
> The problem is that mongrel is serving the static file long before
> rails knows anything about it.
>
> e.g. As I mention in the patch, you have a web server setup with
> multiple virtual hosts each mapped to a separate doc root.
>
> example.com => /var/www/apps/example.com/public
>
> es.example.com => /var/www/apps/example.com/public/es
>
> Rails is using page caching and the cache is clean.
>
> 1st request:
>
> http://example.com =>
>
> 1. web server looks for /var/www/apps/example.com/public/index.html
> 2. passes request to mongrel which does the same thing, doesn't find
> it and calls rails to render it.
> 3. Now /var/www/apps/example.com/public/index.html exists as was
> cached by rails.
>
> 2nd request:
>
> http://es.example.com =>
>
> 1. web server looks for /var/www/apps/example.com/public/es/index.html
> 2. passes request to mongrel which looks for /var/www/apps/example.com/
> public/index.html
> (which unlike the web server, has only one doc root),
> finds the file under /var/www/apps/example.com/public/index.html
> (from the previous request) and serves that back before rails has even
> got a chance to know about it. It has served the wrong file.
>
> I hope this example makes it clearer.
>
> With the ability to force mongrel to forward all requests it receives
> to rails, on the second request rails (using the host info) would then
> cache the index.html file into /var/www/apps/example.com/public/es/
> index.html.
>
> As I was writing this, I just thought of another possibility being
> writing a custom mongrel handler, but as mongrel_rails is a handler
> itself, it seems a bit pointless so I still think my patch has merits.
>
> Thoughts?
>
> Regards,
>
> Saimon
>
>
> On Jan 24, 2008, at 4:42 PM, Nathan Vack wrote:
>
> > On Jan 24, 2008, at 6:13 AM, Saimon Moore wrote:
> >
> >> Hi all,
> >>
> >> I've just added a patch that I'd appreciate some feedback on:
> >>
> >> http://rubyforge.org/tracker/index.php?
> >> func=detail&aid=17446&group_id=1306&atid=5147
> >
> > I'll admit by cold-addled brain isn't following logic perfectly this
> > morning, but I feel like this really would be better handled by the
> > upstream HTTP handler giving enough information to your app so it
> > serves the right cached file (or runs the right controller, or
> > whatever).
> >
> > I think passing the Host: header along with the request_routing
> > plugin (assuming you're on Rails) will make everything happy:
> >
> > http://agilewebdevelopment.com/plugins/request_routing
> >
> > Or am I missing something?
> >
> > -Nate
> > _______________________________________________
> > Mongrel-users mailing list
> > Mongrel-users at rubyforge.org
> > http://rubyforge.org/mailman/listinfo/mongrel-users
>
> --
> Saimon Moore
> Freelance Web Developer
> (Available for hire - For details visit http://saimonmoore.net)
>
> Skype: saimonmoore
> Yahoo IM: saimonmoore
> Google IM: saimonmoore
>
>
>
> _______________________________________________
> Mongrel-users mailing list
> Mongrel-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/mongrel-users
>
More information about the Mongrel-users
mailing list