feat: Add Content Security Policy header and move Plausible script to HTML head with beforeInteractive strategy.
This commit is contained in:
@@ -35,13 +35,15 @@ export default function RootLayout({
|
|||||||
}>) {
|
}>) {
|
||||||
return (
|
return (
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<body className={`${geistSans.variable} ${geistMono.variable}`}>
|
<head>
|
||||||
<Script
|
<Script
|
||||||
defer
|
defer
|
||||||
data-domain="hoerdle.elpatron.me"
|
data-domain="hoerdle.elpatron.me"
|
||||||
src="https://plausible.elpatron.me/js/script.js"
|
src="https://plausible.elpatron.me/js/script.js"
|
||||||
strategy="afterInteractive"
|
strategy="beforeInteractive"
|
||||||
/>
|
/>
|
||||||
|
</head>
|
||||||
|
<body className={`${geistSans.variable} ${geistMono.variable}`}>
|
||||||
{children}
|
{children}
|
||||||
<InstallPrompt />
|
<InstallPrompt />
|
||||||
<AppFooter />
|
<AppFooter />
|
||||||
|
|||||||
@@ -15,6 +15,15 @@ const nextConfig: NextConfig = {
|
|||||||
},
|
},
|
||||||
async headers() {
|
async headers() {
|
||||||
return [
|
return [
|
||||||
|
{
|
||||||
|
source: '/:path*',
|
||||||
|
headers: [
|
||||||
|
{
|
||||||
|
key: 'Content-Security-Policy',
|
||||||
|
value: "script-src 'self' 'unsafe-inline' 'unsafe-eval' https://plausible.elpatron.me; connect-src 'self' https://plausible.elpatron.me;",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
source: '/uploads/:path*.mp3',
|
source: '/uploads/:path*.mp3',
|
||||||
headers: [
|
headers: [
|
||||||
|
|||||||
Reference in New Issue
Block a user