Topic: Noobie asking for help: Routing error when I clear the cache

I'm pretty new to caching, and I'm wondering what I'm doing wrong here.

I have in environment.rb:
config.action_controller.page_cache_directory = RAILS_ROOT + "/public/cache"

In my lighty config file:
url.rewrite += ( "^/$" => "/cache/index.html" )
url.rewrite += ( "^([^.]+)$" => "/cache/$1.html" )

This seems to load the cached files properly when they exist, but when the cache expires, Rails throws a routing error:
ActionController::RoutingError (No route matches "/cache//listings/acc.html" with {:method=>:get}):

Any ideas would be great.

Re: Noobie asking for help: Routing error when I clear the cache

It looks like you are rewriting all your urls as if they are cached pages. When the static html file exists your webserver serves it up. But when it doesn't rails doesn't have any rules to follow in routes.rb to tell it what to do with those urls.

I'm not really knowlegable about lighty. but here's how to do it in Nginx with mongrels.

 if (-f $request_filename.html) {
                                           rewrite (.*) $1.html break;
}

if (!-f $request_filename) {
                                           proxy_pass http://domain1;
                                           break;
}