Replies: 1 comment
-
|
CSRF protection should usually be enforced on browser-originated mutating requests, not on the internal read path Nuxt Content uses during SSR. The likely issue is that SSR is making a server-side request to a content endpoint without the browser CSRF token/header pair that I would try one of these approaches:
For content pages, option 1 or 2 is usually the cleanest. Markdown/content reads are not a CSRF target in the same way a state-changing form submission is, and forcing CSRF onto SSR content fetching can break perfectly valid server-rendered requests. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello everyone 👋
I'm not entirely sure if this is actually a question or potentially a bug, but I'm getting a CSRF Token Mismatch error during server-side rendering when running the nuxt-security module with
csrf: true.I've prepared a minimal reproducible example that demonstrates my current implementation and the the issue.
So the question is: How to fix this error and get CSRF to work with nuxt-content?
Many thanks for your support! 🙏
Beta Was this translation helpful? Give feedback.
All reactions