protected function FinishResponseSubscriber::setResponseNotCacheable
protected FinishResponseSubscriber::setResponseNotCacheable(Response $response, Request $request)
Add Cache-Control and Expires headers to a response which is not cacheable.
Parameters
\Symfony\Component\HttpFoundation\Response $response: A response object.
\Symfony\Component\HttpFoundation\Request $request: A request object.
File
- core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php, line 201
Class
- FinishResponseSubscriber
- Response subscriber to handle finished responses.
Namespace
Drupal\Core\EventSubscriberCode
protected function setResponseNotCacheable(Response $response, Request $request) { $this->setCacheControlNoCache($response); $this->setExpiresNoCache($response); // There is no point in sending along headers necessary for cache // revalidation, if caching by proxies and browsers is denied in the first // place. Therefore remove ETag, Last-Modified and Vary in that case. $response->setEtag(NULL); $response->setLastModified(NULL); $response->setVary(NULL); }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!EventSubscriber!FinishResponseSubscriber.php/function/FinishResponseSubscriber::setResponseNotCacheable/8.1.x