Responses are not cacheable

Created on 7 October 2024, 8 months ago

Responses are not cacheable

This is an easy added feature see patch below.

Feature request
Status

Active

Version

3.3

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @cbstuart
  • Status changed to RTBC 8 days ago
  • 🇳🇱Netherlands seanB Netherlands

    Looks good to me! Thanks.

  • 🇬🇧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;
    
Production build 0.71.5 2024