I understand your confusion about using csurf configuration with route rules in Nuxt Security. However, I need to clarify that the knowledge sources provided to me don't contain specific information about Nuxt Security's CSRF middleware or how to configure csurf in route rules.
Based on the knowledge sources available, I can see that Nuxt supports various route rule properties, but the documents don't explicitly mention csurf as a standard Nitro route rule property. The knowledge sources show examples of route rules like ssr, prerender, isr, appLayout, and appMiddleware, but don't cover CSRF-specific configuration.
What I can tell you:
From the knowledge sources, I can see that:
-
Route rules in Nuxt can be extended with custom properties through modules - as shown in the feat(nuxt): support appLayout in route rules PR, where custom properties can be added to the route rules type system.
-
The feat(nuxt): add appMiddleware route rule PR demonstrates that middleware can be configured via route rules.
My recommendation:
Since csurf appears to be a Nuxt Security module-specific configuration, it's likely that the Nuxt Security module extends the standard Nitro route rules with its own properties. This is a common pattern in Nuxt modules. The fact that you don't see csurf in the standard Nitro route rules documentation is expected - it would be added by the Nuxt Security module itself.