<?php
namespace App\EventListener;
use Symfony\Component\HttpKernel\Event\ResponseEvent;
class NoCacheListener
{
public function onKernelResponse(ResponseEvent $event): void
{
$route = $event->getRequest()->attributes->get('_route');
if (!in_array($route, [
'frontend_auction_list',
'frontend_auction_box',
'frontend_server_date',
])) {
return;
}
$response = $event->getResponse();
$response->setMaxAge(0);
$response->headers->addCacheControlDirective('must-revalidate');
$response->headers->addCacheControlDirective('no-store');
$response->headers->addCacheControlDirective('no-cache');
}
}