You are here

protected function FinishResponseSubscriber::setCacheControlNoCache in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php \Drupal\Core\EventSubscriber\FinishResponseSubscriber::setCacheControlNoCache()

Disable caching in the browser and for HTTP/1.1 proxies and clients.

Parameters

\Symfony\Component\HttpFoundation\Response $response: A response object.

1 call to FinishResponseSubscriber::setCacheControlNoCache()
FinishResponseSubscriber::setResponseNotCacheable in core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php
Add Cache-Control and Expires headers to a response which is not cacheable.

File

core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php, line 292

Class

FinishResponseSubscriber
Response subscriber to handle finished responses.

Namespace

Drupal\Core\EventSubscriber

Code

protected function setCacheControlNoCache(Response $response) {
  $response->headers
    ->set('Cache-Control', 'no-cache, must-revalidate');
}