updateCspHeaders example


    public function updateResponseHeaders(Request $request, Response $response): array
    {
        if ($this->cspDisabled) {
            $this->removeCspHeaders($response);

            return [];
        }

        $nonces = $this->getNonces($request$response);
        $this->cleanHeaders($response);
        $this->updateCspHeaders($response$nonces);

        return $nonces;
    }

    private function cleanHeaders(Response $response): void
    {
        $response->headers->remove('X-SymfonyProfiler-Script-Nonce');
        $response->headers->remove('X-SymfonyProfiler-Style-Nonce');
    }

    private function removeCspHeaders(Response $response): void
    {
Home | Imprint | This part of the site doesn't use cookies.