setExpiresNoCache example

    // another place.     if (!$response instanceof CacheableResponseInterface) {
      if (!$this->isCacheControlCustomized($response)) {
        $this->setResponseNotCacheable($response$request);
      }

      // HTTP/1.0 proxies do not support the Vary header, so prevent any caching       // by sending an Expires date in the past. HTTP/1.1 clients ignore the       // Expires header if a Cache-Control: max-age directive is specified (see       // RFC 2616, section 14.9.3).       if (!$response->headers->has('Expires')) {
        $this->setExpiresNoCache($response);
      }
      return;
    }

    if ($this->debugCacheabilityHeaders) {
      // Expose the cache contexts and cache tags associated with this page in a       // X-Drupal-Cache-Contexts and X-Drupal-Cache-Tags header respectively.       $response_cacheability = $response->getCacheableMetadata();
      $cache_tags = $response_cacheability->getCacheTags();
      sort($cache_tags);
      $response->headers->set('X-Drupal-Cache-Tags', implode(' ', $cache_tags));
      
Home | Imprint | This part of the site doesn't use cookies.