Skip to content

Commit

Permalink
docs: move doc to usage
Browse files Browse the repository at this point in the history
  • Loading branch information
huang-julien committed Jan 10, 2024
1 parent c58491a commit 10c6161
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 37 deletions.
34 changes: 34 additions & 0 deletions docs/content/1.documentation/1.getting-started/3.usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,3 +169,37 @@ export default defineNuxtConfig({
}
})
```

## Runtime configuration

If you need to change the headers configuration at runtime, it is possible to do it through `nuxt-security:headers` hook.

### Enabling the option

This feature is optional, you can enable it with

```ts
export default defineNuxtConfig({
modules: ['nuxt-security'],
security: {
runtimeHooks: true
}
})
```

### Usage

Within your nitro plugin. You can override the previous configuration of a route with `nuxt-security:headers`.

```ts
export default defineNitroPlugin((nitroApp) => {
nitroApp.hooks.hook('nuxt-security:ready', () => {
nitroApp.hooks.callHook('nuxt-security:headers', '/**' ,{
contentSecurityPolicy: {
"script-src": ["'self'", "'unsafe-inline'"],
},
xFrameOptions: false
})
})
})
```
37 changes: 0 additions & 37 deletions docs/content/1.documentation/2.headers/15.runtimeConfiguration.md

This file was deleted.

0 comments on commit 10c6161

Please sign in to comment.