Skip to content

DenyCacheableBinaryFileResponse

Keeps cacheable file responses out of the Dynamic Page Cache.

CacheableBinaryFileResponse is only meant to be cached by reverse proxies and CDNs. A Dynamic Page Cache hit would skip the controller, along with any access checks it does itself, such as hook_file_download(). This policy is only used by the Dynamic Page Cache: it must not be added to the page cache response policy, which FinishResponseSubscriber also uses to decide whether to send cacheable headers.


  • Full name: \Drupal\helper\PageCache\ResponsePolicy\DenyCacheableBinaryFileResponse
  • This class is marked as final and can't be subclassed
  • This class implements: ResponsePolicyInterface
  • This class is a Final class

See Also:

  • https://www.drupal.org/project/drupal/issues/3227041

Methods

check

{@inheritdoc}

public check(\Symfony\Component\HttpFoundation\Response $response, \Symfony\Component\HttpFoundation\Request $request): ?string

Parameters:

Parameter Type Description
$response \Symfony\Component\HttpFoundation\Response
$request \Symfony\Component\HttpFoundation\Request