Replies: 2 comments 13 replies
-
Hey @maxdzin This is a really interesting feature! I would completely see the usage of it as a similar approach to useSeoMeta. I am just not sure if its doable from the Nuxt side as right now Nuxt Security uses either runtime config or routeRules to configure server middlewares dynamically. @danielroe what do you think about it? |
Beta Was this translation helpful? Give feedback.
-
I tried to make this work but for some reason the composable I created does not work :( import type {
NuxtSecurityRouteRules
} from '../../types'
export function useSecurity (config: NuxtSecurityRouteRules & { headers?: Record<string, string> }) {
const { headers, ...security } = config
defineRouteRules({
security,
headers
})
} I tried adding normal experimental: {
inlineRouteRules: true
}, And at this point I wonder if it actually makes sense to create such composable. Right now, users can easily configure per page routes like (after enabling it in the nuxt.config.ts): defineRouteRules({
headers: {
'X-XSS-Protection': '1'
},
security: {
rateLimiter: {
tokensPerInterval: 3,
interval: 60000,
},
}
}) Not sure if it makes sense to do that (Especially that it does not work) |
Beta Was this translation helpful? Give feedback.
-
Hey @Baroshem, is it possible to set the security settings on the page directly?
It would be good to have since it requires to be set by certain conditions sometimes.
So, it would be nice to have some composable, similar to useSeoMeta.
And so in the
/pages/[slug].vue
:Whad do you think?
Beta Was this translation helpful? Give feedback.
All reactions