alleyinteractive/wp-alleyvate

[FEATURE] Full-Page Caching for 404s

Closed this issue · 2 comments

An easy way to cause a performance issue on a WP site, particularly one that has full-page caching based on URLs, is to make a bunch of requests that will result in 404s, because those requests bypass the full page cache and hit PHP, which has to build the 404 page. However, the 404 page contents should be the same irrespective of which URL was accessed to trigger it, which makes it ripe for a solution to cache 404 page output.

I propose that we build in a feature, which is enabled by default, to cache the full HTML output of a 404 view, which can be served from cache very early in the request (as soon as we know for sure it's a 404). The 404 page doesn't change very often, so this cache can be long-lived (24 hours, say). That way, even if there is a flood of requests for bad URLs, those requests can be fielded quickly from a pre-cached response.

Needs feedback and testing: #46