[Mongrel] Moving page_cache_directory

Rick Olson technoweenie at gmail.com
Tue Oct 31 10:24:23 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.
>
> RSL

I would think that you could just set up a custom DirHandler, but the
RailsHandler is taking up the root uri.  I'm not sure this would work,
but use a config script like this:

uri "/", Mongrel::DirHandler.new("path/to/public/cache",
listing_allowed=true, index_html="index.html"), :in_front => true

(the 2nd and 3rd params of DirHandler.new are optional).

I'm not sure if the DirHandler will return 404's or just pass on to
the next handler in line, which would be the Rails Handler.  If this
doesn't work, you'll have to hack the RailsHandler probably.

-- 
Rick Olson
http://weblog.techno-weenie.net
http://mephistoblog.com


More information about the Mongrel-users mailing list