protected function cleanupHeadersForProd(Response $response)
    {
        // remove headers that identify the content or internal digest info
        $response->headers->remove('xkey');
        $response->headers->remove('x-content-digest');

        // remove vary by X-User-Hash header
        $varyValues = [];
        $variesByUser = false;
        foreach ($response->getVary() as $value) {
            if ($value === 'X-User-Hash') {
                $variesByUser = true;
            } else {
                $varyValues[] = $value;
            }
        }

        // update resulting vary header in normalized form (comma separated)
        if (empty($varyValues)) {
            $response->headers->remove('Vary');
        } else {
            $response->setVary(implode(', ', $varyValues));
        }

        // If cache varies by user hash, then make sure other proxies don't cache this
        if ($variesByUser) {
            $response->setPrivate();
            $response->headers->removeCacheControlDirective('s-maxage');
            $response->headers->addCacheControlDirective('no-cache');
        }
    }
protected function cleanupHeadersForProd(Response $response)
    {
        // remove headers that identify the content or internal digest info
        $response->headers->remove('xkey');
        $response->headers->remove('x-content-digest');

        // remove vary by X-User-Hash header
        $varyValues = [];
        $variesByUser = false;
        foreach ($response->getVary() as $value) {
            if ($value === 'X-User-Hash') {
                $variesByUser = true;
            } else {
                $varyValues[] = $value;
            }
        }

        // update resulting vary header in normalized form (comma separated)
        if (empty($varyValues)) {
            $response->headers->remove('Vary');
        } else {
            $response->setVary(implode(', ', $varyValues));
        }

        // If cache varies by user hash, then make sure other proxies don't cache this
        if ($variesByUser) {
            $response->setPrivate();
            $response->headers->removeCacheControlDirective('s-maxage');
            $response->headers->addCacheControlDirective('no-cache');
        }
    }
protected function cleanupHeadersForProd ( Response $ response ) { // remove headers that identify the content or internal digest info $ response -> headers -> remove ( 'xkey' ) ; $ response -> headers -> remove ( 'x-content-digest' ) ; // remove vary by X-User-Hash header $ varyValues = [ ] ; $ variesByUser = false ; foreach ( $ response -> getVary ( ) as $ value ) { if ( $ value === 'X-User-Hash' ) { $ variesByUser = true ; } else { $ varyValues [ ] = $ value ; } } // update resulting vary header in normalized form (comma separated) if ( empty ( $ varyValues ) ) { $ response -> headers -> remove ( 'Vary' ) ; } else { $ response -> setVary ( implode ( ', ' , $ varyValues ) ) ; } // If cache varies by user hash, then make sure other proxies don't cache this if ( $ variesByUser ) { $ response -> setPrivate ( ) ; $ response -> headers -> removeCacheControlDirective ( 's-maxage' ) ; $ response -> headers -> addCacheControlDirective ( 'no-cache' ) ; } }
Perform cleanup of reponse.

@param Response $response
Perform cleanup of reponse .