Closed janvitos closed 3 years ago
Thanks for your feature request, @janvitos. Like with our other requests let's see if anyone else is interested in this type of behavior before introducing it. If it were to be introduced it'd likely be through a filter hook, like maybe allowing cacheable HTTP status codes to be filtered where 200
is the default.
Unfortunately there isn't a way of achieving this right now, but the following snippet is what currently controls this behavior:
Thanks @coreykn.
I found that filter and did comment it out for the moment, enabling caching of all status codes, including 404.
The main reason why I think it would be beneficial is to prevent bots / attackers from requesting tons of 404 pages and possibly overloading the web server.
Such requests have been hitting my web server lately, but fortunately, they have not yet been cause of concern. I would prefer to block those bots, but they are spoofing good bot user agents, so it's pretty hard. At least, by caching the 404 pages, this reduces the load on the web server and prevents any possible future problems.
I know this might be a specific issue that not everyone has to deal with, but I still think it would make a great addition to the plugin. A filter would definitely be welcome.
Cheers.
I was able to create a page rule to cache 404 pages with CloudFlare, so caching with the plugin is not necessary anymore.
Thanks.
Hi,
In most WordPress cache plugins, there is an option to cache 404 / error pages. I believe this would be a great addition to Cache Enabler as caching repeat error pages can ease the load on the web server.
In the meantime, would there be any way of achieving this with an existing filter or similar?
Thanks!