Installation

Having more secure Nuxt project is only one command away ✨


Install nuxt-security module:

npx nuxi@latest module add security

That's it! The Nuxt Security module will now register routeRules 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',
    },
  },
});