mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
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
23 lines
375 B
TypeScript
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"
|
|
/>
|
|
</>
|
|
)
|
|
}
|