['onResponse', -300]]; } public function onResponse(ResponseEvent $event): void { if (!preg_match('#^/admin(?:/|$)#', $event->getRequest()->getPathInfo())) { return; } $headers = $event->getResponse()->headers; $headers->set('Cache-Control', 'private, no-store'); $headers->set('X-Robots-Tag', 'noindex, nofollow'); $headers->set('X-Content-Type-Options', 'nosniff'); $headers->set('Referrer-Policy', 'same-origin'); $headers->set('Permissions-Policy', 'accelerometer=(), camera=(), display-capture=(), geolocation=(), gyroscope=(), microphone=(), payment=(), usb=()'); // The preview must show the same typeface as the published page, so the font hosts are // allowed here as well. Everything else stays as narrow as on the public side. $headers->set('Content-Security-Policy', "default-src 'self'; script-src 'self'; style-src 'self' https://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com; img-src 'self' https:; object-src 'none'; base-uri 'none'; frame-ancestors 'none'; form-action 'self'"); } }