public function onKernelResponse(FilterResponseEvent $event)
    {
        if (HttpKernelInterface::MASTER_REQUEST != $event->getRequestType()) {
            return;
        }

        if (!in_array($event->getRequest()->get('_route'), $this->routes)) {
            return;
        }

        $response = $event->getResponse();
        $varyHeaders = $response->headers->get('vary', null, false);

        foreach ($this->userIdentifierHeaders as $removableVary) {
            unset($varyHeaders[array_search(strtolower($removableVary), $varyHeaders)]);
        }
        $response->setVary($varyHeaders, true);
    }
public function onKernelResponse(FilterResponseEvent $event)
    {
        if (HttpKernelInterface::MASTER_REQUEST != $event->getRequestType()) {
            return;
        }

        if (!in_array($event->getRequest()->get('_route'), $this->routes)) {
            return;
        }

        $response = $event->getResponse();
        $varyHeaders = $response->headers->get('vary', null, false);

        foreach ($this->userIdentifierHeaders as $removableVary) {
            unset($varyHeaders[array_search(strtolower($removableVary), $varyHeaders)]);
        }
        $response->setVary($varyHeaders, true);
    }
public function onKernelResponse ( FilterResponseEvent $ event ) { if ( HttpKernelInterface :: MASTER_REQUEST != $ event -> getRequestType ( ) ) { return ; } if ( ! in_array ( $ event -> getRequest ( ) -> get ( '_route' ) , $ this -> routes ) ) { return ; } $ response = $ event -> getResponse ( ) ; $ varyHeaders = $ response -> headers -> get ( 'vary' , null , false ) ; foreach ( $ this -> userIdentifierHeaders as $ removableVary ) { unset ( $ varyHeaders [ array_search ( strtolower ( $ removableVary ) , $ varyHeaders ) ] ) ; } $ response -> setVary ( $ varyHeaders , true ) ; }
Remove Vary headers for matched routes.

@param FilterResponseEvent $event
Remove Vary headers for matched routes .