- Issue created by @cbstuart
- Status changed to RTBC
8 days ago 9:38pm 26 May 2025 - 🇬🇧United Kingdom pobster
This is a bad idea, 404 responses shouldn't be cached (for many reasons).
The two biggest reasons are that anyone can then easily overwhelm your cache by filling it with nonsense, and also - say you want to add something to your site, but it's already in the cache as a 404 - it'll carry on 404ing even though it exists!
- 🇳🇱Netherlands seanB Netherlands
Drupal supports caching 4xx responses, so we can make it depend on the setting:
/** * Cache TTL for client error (4xx) responses. * * Items cached per-URL tend to result in a large number of cache items, and * this can be problematic on 404 pages which by their nature are unbounded. A * fixed TTL can be set for these items, defaulting to one hour, so that cache * backends which do not support LRU can purge older entries. To disable caching * of client error responses set the value to 0. Currently applies only to * page_cache module. */ # $settings['cache_ttl_4xx'] = 3600;