Change record status: 
Project: 
Introduced in branch: 
8.6.x
Introduced in version: 
8.6.0-alpha1
Description: 

As part of the system.performance config, Drupal includes the cache.page.max_age property that provides the max-age value in Cache-Control header on cacheable responses. There are many scenarios where it is desirable to have an independent max-age for 4xx responses.

A new property is being introduced to allow the emitted max-age for 4xx responses to be set independent of the standard max-age.

Still part of the system.performance config, this new property is named cache.page.4xx_max_age and set to null initially. The emitted max-age for 4xx responses will fallback to the standard cache.page.max_age if not set.

There is no UI being provided to control the value of cache.page.4xx_max_age, but developers can set it in code with a config update or directly in a settings.php file.

Before:

// Set value for max-age in Cache-Control header.
$config['system.performance']['cache']['page']['max_age'] = 1800;

After:

// Set value for max-age in Cache-Control header.
$config['system.performance']['cache']['page']['max_age'] = 1800;
// Set value for max-age in Cache-Control header on 4xx responses.
$config['system.performance']['cache']['page']['4xx_max_age'] = 300;
Impacts: 
Site builders, administrators, editors
Module developers