#Dynamic rendering with inline script nonce

4 messages · Page 1 of 1 (latest)

quick citrus
#

I'm adding middleware to generate a nonce for inline scripts to my app. I'm following the instructions at https://nextjs.org/docs/app/building-your-application/configuring/content-security-policy

The instructions state "Every time a page is viewed, a fresh nonce should be generated. This means that you must use dynamic rendering to add nonces."

How do I ensure dynamic rendering?

Do I have to add the export const dynamic = "force-dynamic"; directive to every single page?

I'm using app router.

Learn how to set a Content Security Policy (CSP) for your Next.js application.

patent whaleBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

covert kiln
quick citrus
#

Thanks.