[Mongrel] Moving page_cache_directory

Jan Svitok jan.svitok at gmail.com
Tue Oct 31 10:44:29 EST 2006

On 10/31/06, Russell Norris <rsl at swimcommunity.org> wrote:
> Howdy. I'm working on a RoR CMS and need cached pages to all be in
> public/cache rather than public [in order to set svn:ignore on all the files
> properly]. I can get page_cache_directory set correctly and the pages are
> cached in the right place but Mongrel isn't serving them because it's only
> looking for them in public. During development I know I can set -r
> public/cache but doing that means that the images and stylesheets don't get
> picked up. I'm sure there's a way to tell Mongrel to look in both places or
> at least to serve assets from public and cached pages from public/cache.
> Isn't there?
> Thanks in advance.

I'm not sure if any of these will work, they're just hints:

1. try prepend DirHandler mounted to public/cache :in_front of rails
handler using -S switch
          uri "/", :handler => Mongrel::DirHandler.new("/public/cache", false)
   This will unfortunately not look for PATH_INFO + '.html' files.

2. try patching RailsHandler to look also in cache. For that a proxy handler
  would be useful - one that will hold more DirHandlers and will
delegate to whichever
  wants to serve the particular file. In this case RailsHandler will
take care of +.html files.
  You'd need to implement new, can_serve? and process which seems pretty easy.

More information about the Mongrel-users mailing list