Files
JJ KasperandGitHub 617867f3f1 Add nonce handling from CSP in pages router (#78936)
Our docs never called out that the nonce from a
`content-security-policy` header would only automatically be set in app
router. This adds handling to ensure it is also set for pages router.

Fixes #67042
Closes NEXT-4104
2025-05-07 19:57:40 -07:00

23 lines
375 B
TypeScript

import React from 'react'
import Script from 'next/script'
export function getServerSideProps() {
return {
props: {
now: Date.now(),
},
}
}
export default function Page() {
return (
<>
<p>pages-nonce</p>
<Script
dangerouslySetInnerHTML={{ __html: 'console.log("hi")' }}
strategy="afterInteractive"
/>
</>
)
}