Fascgi Cache caching error pages


#1

I was just doing some DB maintenance on my server and in the process there were a few minutes where I mistakenly had nginx running while mysql was down. Unfortunately as I discovered later, fastcgi cache was dutifully caching all the 5XX error pages that were being generated due to inability to connect to the database. So even after I brought mysql back up, nginx kept serving those cached error pages.

I think that the solution is to only cache pages that have a 200 response code and we could do that by changing the fastcgi_cache_valid line in /etc/conf.d/fastcgi.conf from this:

fastcgi_cache_valid any 1h;

to this:

fastcgi_cache_valid 200 1h;

Before I put an issue and pull request on github, I thought I’d bring it up here and see if anyone knows a reason why that’s a bad idea.


#2

any covers 3xx and 4xx response as well which we intended to cache.

3xx is for 301/302 which deals with redirections.

4xx is for 404 mainly to cache broken links.

I believe 500 should not be cached.

If you can send a pull request based on above, that will be great. :slight_smile:


#3

Hi @pjv

It’s been a long time, and we haven’t heard from you. It looks like your issue is resolved.

I am closing this support topic for now. Feel free to create a new support topic if you have any queries further. :slight_smile:


#4