$max_age =
$this->config->
get('cache.page.max_age'
);
$response->headers->
set('Cache-Control', 'public, max-age=' .
$max_age);
// In order to support HTTP cache-revalidation, ensure that there is a
// Last-Modified and an ETag header on the response.
if (!
$response->headers->
has('Last-Modified'
)) { $timestamp = REQUEST_TIME;
$response->
setLastModified(new \
DateTime(gmdate(DateTimePlus::RFC7231, REQUEST_TIME
)));
} else { $timestamp =
$response->
getLastModified()->
getTimestamp();
} $response->
setEtag($timestamp);
// Allow HTTP proxies to cache pages for anonymous users without a session
// cookie. The Vary header is used to indicates the set of request-header
// fields that fully determines whether a cache is permitted to use the
// response to reply to a subsequent request for a given URL without
// revalidation.
if (!
$response->
hasVary() && !Settings::
get('omit_vary_cookie'
)) { $response->
setVary('Cookie', FALSE
);
} }