Installation

Having more secure Nuxt project is only one command away ✨


Install nuxt-security module:

Yarn
yarn add --dev nuxt-security@rc
NPM
npm install nuxt-security@rc --save-dev
PNPM
pnpm add -D nuxt-security@rc

Add it to modules in your nuxt.config:

nuxt.config.ts
export default defineNuxtConfig({  modules: ['nuxt-security']})

That's it! The Nuxt Security module will now register routeRoules and middleware to make your application more secure ✨

Configuration

Add a security section in your nuxt.config:

security: {  // Options}

You can find more about configuring nuxt-security here.

Using with Nuxt DevTools

In order to make this module work with Nuxt DevTools add following configuration to your projects:

nuxt.config.ts
export default defineNuxtConfig({  modules: ['nuxt-security', '@nuxt/devtools'],  security: {    headers: {      crossOriginEmbedderPolicy: process.env.NODE_ENV === 'development' ? 'unsafe-none' : 'require-corp',    },  },});