Skip to content

strict-dynamic CSP support for hybrid Next.js apps #34582

Closed Locked Answered by leerob
nibtime asked this question in Show and tell
Discussion options

You must be logged in to vote

Hey folks, wanted to swing back here with an update. After digging through many different issues and discussions, I've made a new page in the documentation (PR) specifically for Content Security Policy and nonces. This docs page:

  • Explains how to generate a nonce with Middleware
  • Shows how to consume the nonce in a route with headers()
  • Shows a complete CSP without needing to use any unsafe
  • Shows how to ignore the nonce Middleware from running on prefetches / static assets

Further, we've patched some bugs and made improvements to nonce handling in Next.js that will be available in the latest canary version (for those of you time traveling from the future, upgrade to Next.js 13.5). We also …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by leerob
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants