🛡 Security Module for Nuxt based on OWASP Top 10 and Helmet
Security module for Nuxt based on OWASP Top 10 and helmet that adds security response headers, protection middlewares, CORS, and more.
[Optional] Basic Auth support[Optional] CSRF supportInstall the module:
npm i nuxt-security --save-dev # yarn or pnpm
Add the module in the modules array in nuxt.config.ts:
export default defineNuxtConfig({
modules: ["nuxt-security"],
})
And that’s it! The module will now register route roules and server middlewares globally so that your application will be more secured.
This module is meant to work with SSR apps but you can also use this module in SSG apps where you will get a Content Security Policy (CSP) support via <meta http-equiv> tag. You can find more about configuring Content Security Policy (CSP) here.
You can pass configuration to the module in the nuxt.config.ts like following:
export default defineNuxtConfig({
modules: ["nuxt-security"],
security: {
// options
}
})
For all available configuration options check out the docs.
yarn dev:prepare to generate type stubs.yarn dev to start playground in development mode.We use cookies
We use cookies to analyze traffic and improve your experience. You can accept or reject analytics cookies.