feat: ajouter les en-têtes de sécurité pour atteindre 100/100 sur MDN Observatory

This commit is contained in:
2026-07-08 00:27:57 +04:00
parent 99daeb014c
commit b5a3b278ba
8 changed files with 196 additions and 13 deletions
+8 -3
View File
@@ -1,3 +1,4 @@
import {headers} from 'next/headers'
import PlausibleProvider from 'next-plausible'
import TopLoader from '../components/top-loader'
import Navigasyon from '../components/navigasyon'
@@ -61,16 +62,20 @@ const jsonLd = {
}
export default async function RootLayout({children}) {
const requestHeaders = await headers()
const nonce = requestHeaders.get('x-nonce') || undefined
const inner = (
<>
<TopLoader color='#ffeb3b' />
<ThemeRegistry>
<TopLoader color='#ffeb3b' nonce={nonce} />
<ThemeRegistry nonce={nonce}>
<Navigasyon />
{children}
</ThemeRegistry>
<section>
<script
type='application/ld+json'
nonce={nonce}
dangerouslySetInnerHTML={{__html: JSON.stringify(jsonLd)}}
/>
</section>
@@ -81,7 +86,7 @@ export default async function RootLayout({children}) {
<html suppressHydrationWarning lang='fr'>
<body>
{plausibleUrl
? <PlausibleProvider src={plausibleUrl}>{inner}</PlausibleProvider>
? <PlausibleProvider src={plausibleUrl} scriptProps={{nonce}}>{inner}</PlausibleProvider>
: inner}
</body>
</html>