Commit 24005696 authored by catch's avatar catch

Issue #2257807 by znerol: Remove 'Forever' from the Page cache maximum age options.

parent 2b2b97d2
......@@ -895,13 +895,6 @@ function drupal_serve_page_from_cache(stdClass $cache, Response $response, Reque
// max-age > 0, allowing the page to be cached by external proxies, when a
// session cookie is present unless the Vary header has been replaced.
$max_age = !$request->cookies->has(session_name()) || isset($boot_headers['vary']) ? $config->get('cache.page.max_age') : 0;
// RFC 2616, section 14.21 says: 'To mark a response as "never expires," an
// origin server sends an Expires date approximately one year from the time
// the response is sent. HTTP/1.1 servers SHOULD NOT send Expires dates more
// than one year in the future.'
if ($max_age > 31536000 || $max_age === \Drupal\Core\Cache\Cache::PERMANENT) {
$max_age = 31536000;
}
$response->headers->set('Cache-Control', 'public, max-age=' . $max_age);
// Entity tag should change if the output changes.
......
......@@ -84,7 +84,6 @@ public function buildForm(array $form, array &$form_state) {
$period = array(0, 60, 180, 300, 600, 900, 1800, 2700, 3600, 10800, 21600, 32400, 43200, 86400);
$period = array_map('format_interval', array_combine($period, $period));
$period[0] = '<' . t('no caching') . '>';
$period[\Drupal\Core\Cache\Cache::PERMANENT] = t('Forever');
$form['caching']['page_cache_maximum_age'] = array(
'#type' => 'select',
'#title' => t('Page cache maximum age'),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment