You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is erroneously showing the app router docs for pages router,
however nonce handling was not added to pages router (support is being
added in #78936) and the included examples are using server components.
Copy file name to clipboardExpand all lines: docs/01-app/02-guides/content-security-policy.mdx
+50-1Lines changed: 50 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -172,7 +172,54 @@ export const config = {
172
172
173
173
### Reading the nonce
174
174
175
-
You can now read the nonce from a [Server Component](/docs/app/building-your-application/rendering/server-components) using [`headers`](/docs/app/api-reference/functions/headers):
You can read the nonce from a [Server Component](/docs/app/building-your-application/rendering/server-components) using [`headers`](/docs/app/api-reference/functions/headers):
176
223
177
224
```tsx filename="app/page.tsx" switcher
178
225
import { headers } from'next/headers'
@@ -208,6 +255,8 @@ export default async function Page() {
208
255
}
209
256
```
210
257
258
+
</AppOnly>
259
+
211
260
## Without Nonces
212
261
213
262
For applications that do not require nonces, you can set the CSP header directly in your [`next.config.js`](/docs/app/api-reference/config/next-config-js) file:
0 commit comments