Topic: Page Caching in Rails does not work when Database is down?

I'm using rails 2.3 have not ported over to the latest version yet.

So I'm doing caching on whole pages and in my public directory I will have a "index.html" page for my home page thats get generated during certain times of the day.  So basically there is a "index.html" sitting in my public dir all the time.

My question is if my mysql database goes down and there is an "index.html" in the public directory shouldn't apache serve the index.html page even if the database is down? 

Right now I'm seeing behavior where when the database is down and I get served a 500 error page instead of the index.html page. What I want to see is the index.html page served instead of the 500 error page while the database comes back online.

Last edited by rank2 (2011-11-10 11:58:50)

Re: Page Caching in Rails does not work when Database is down?

Does this happen on your production environment? Probably this is because the rails application process serves the file, instead of the underlying webserver. Can you post the config of your apache?

Re: Page Caching in Rails does not work when Database is down?

yes this happens in the production environment. Im using modrails apache module.  I also noticed that in my production.log that it records the hit there but if the index.html page is there shouldn't it serve that instead and not log?

Re: Page Caching in Rails does not work when Database is down?

Ok I think the problem is in the custom caching I'm doing.  Instead of /public/index.html I have /public/www.MYSITE.com/index.html and /public/m.MYSITE.com/index.html for mobile site caching.

It seems the apache modrails doesn't know to look there.