Skip to content

Commit cbfb905

Browse files
committed
fix: typos in docs
1 parent 9f17263 commit cbfb905

File tree

2 files changed

+50
-58
lines changed

2 files changed

+50
-58
lines changed

docs/content/1.getting-started/3.usage.md

Lines changed: 48 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,10 @@ title: Usage
33
description: Learn how to use headers and middleware both globally and per route.
44
---
55

6-
7-
86
Nuxt Security by default registers a set of **global** Nuxt `routeRules` that will make your application more secure by default. Both headers and middleware can be easily configured and even disabled when needed.
97

108
::callout{icon="i-heroicons-light-bulb"}
11-
Read more about security headers [here](https://cheatsheetseries.owasp.org/cheatsheets/Nodejs_Security_Cheat_Sheet.html#use-appropriate-security-headers).
9+
Read more about security headers [here](https://cheatsheetseries.owasp.org/cheatsheets/Nodejs_Security_Cheat_Sheet.html#use-appropriate-security-headers).
1210
::
1311

1412
## Global configuration
@@ -73,7 +71,6 @@ If your application defines conflicting headers at both levels, the `security` p
7371

7472
For more information on `routeRules` please see the [Nuxt documentation](https://nuxt.com/docs/guide/concepts/rendering#hybrid-rendering)
7573

76-
7774
## Runtime hooks
7875

7976
If you need to change the configuration at runtime, it is possible to do it through the `nuxt-security:routeRules` hook.
@@ -88,7 +85,7 @@ export default defineNitroPlugin((nitroApp) => {
8885
// You can fetch configuration data asynchronously from an external source
8986
const validDomain = await $fetch('https://some-site.com/rules')
9087
// You can then override the security options of any route
91-
routeRules['/some/route'] = {
88+
routeRules['/some/route'] = {
9289
headers: {
9390
contentSecurityPolicy: {
9491
"connect-src": ["'self'", validDomain]
@@ -111,58 +108,54 @@ Headers delivered on other resources (e.g. images, js and css files, api routes
111108

112109
Nuxt-Security applies your rules in the following prority order:
113110

114-
115111
1. Default rules
116112

117-
Nuxt-Security default values.
118-
See [here](/getting-started/configuration#default)
119-
113+
Nuxt-Security default values.
114+
See [here](/getting-started/configuration#default)
120115

121116
2. Inline module options
122117

123-
```ts{}[nuxt.config.ts]
124-
export default defineNuxtConfig({
125-
modules: [
126-
['nuxt-security', { /* Inline Options */ }]
127-
]
128-
})
129-
```
130-
118+
```ts{}[nuxt.config.ts]
119+
export default defineNuxtConfig({
120+
modules: [
121+
['nuxt-security', { /* Inline Options */ }]
122+
]
123+
})
124+
```
131125

132126
3. Global module options
133127

134-
```ts{}[nuxt.config.ts]
135-
export default defineNuxtConfig({
136-
security: {
137-
// Global Options
138-
}
139-
})
140-
```
128+
```ts{}[nuxt.config.ts]
129+
export default defineNuxtConfig({
130+
security: {
131+
// Global Options
132+
}
133+
})
134+
```
141135

142136
4. Per-route options
143137

144-
```ts{}[nuxt.config.ts]
145-
export default defineNuxtConfig({
146-
routeRules: {
147-
'/some-route': {
148-
security: {
149-
// Per-route Options
150-
}
138+
```ts{}[nuxt.config.ts]
139+
export default defineNuxtConfig({
140+
routeRules: {
141+
'/some-route': {
142+
security: {
143+
// Per-route Options
151144
}
152145
}
153-
})
154-
```
146+
}
147+
})
148+
```
155149

156150
5. Runtime-hook options
157151

158-
```ts{}[server/plugins/filename.ts]
159-
export default defineNitroPlugin((nitroApp) => {
160-
nitroApp.hooks.hook('nuxt-security:routeRules', routeRules => {
161-
// Runtime Options
162-
})
152+
```ts{}[server/plugins/filename.ts]
153+
export default defineNitroPlugin((nitroApp) => {
154+
nitroApp.hooks.hook('nuxt-security:routeRules', routeRules => {
155+
// Runtime Options
163156
})
164-
```
165-
157+
})
158+
```
166159

167160
## Route merging strategy (nested router)
168161

@@ -196,10 +189,9 @@ export default defineNuxtConfig({
196189
})
197190
```
198191

199-
200192
## Inline route configuration
201193

202-
You can also use route roules in pages like following:
194+
You can also use route rules in pages like following:
203195

204196
```vue
205197
<template>
@@ -214,8 +206,8 @@ defineRouteRules({
214206
},
215207
rateLimiter: {
216208
tokensPerInterval: 3,
217-
interval: 60000,
218-
},
209+
interval: 60000
210+
}
219211
}
220212
})
221213
</script>
@@ -260,7 +252,6 @@ export default defineNuxtConfig({
260252
})
261253
```
262254

263-
264255
## Modifying security options
265256

266257
Within your runtime hooks, you can either modify or overwrite the existing values for any security option.
@@ -275,7 +266,7 @@ One of the easiest way to merge existing rules with your own is to use `defuRepl
275266
export default defineNitroPlugin((nitroApp) => {
276267
nitroApp.hooks.hook('nuxt-security:routeRules', async(routeRules) => {
277268
routeRules['/some/route'] = defuReplaceArray(
278-
{
269+
{
279270
headers: {
280271
contentSecurityPolicy: {
281272
"script-src": ["'self'", "..."]
@@ -289,8 +280,9 @@ export default defineNitroPlugin((nitroApp) => {
289280
})
290281
```
291282

292-
In the example above,
293-
- All existing security options for `/some/route` will be maintained, and only the `script-src` CSP directive will be modified.
283+
In the example above,
284+
285+
- All existing security options for `/some/route` will be maintained, and only the `script-src` CSP directive will be modified.
294286
- The existing content of the `script-src` directive will be erased and replaced by your values
295287

296288
Read more about [`defuReplaceArray`](/advanced/auto-imports/#defuReplaceArray)
@@ -309,7 +301,7 @@ import { defu } from 'defu'
309301
export default defineNitroPlugin((nitroApp) => {
310302
nitroApp.hooks.hook('nuxt-security:routeRules', async(routeRules) => {
311303
routeRules['/some/route'] = defu(
312-
{
304+
{
313305
headers: {
314306
contentSecurityPolicy: {
315307
"script-src": ["'self'", "..."]
@@ -323,21 +315,21 @@ export default defineNitroPlugin((nitroApp) => {
323315
})
324316
```
325317

326-
In the example above,
327-
- All existing security options for `/some/route` will be maintained, and only the `script-src` CSP directive will be modified.
318+
In the example above,
319+
320+
- All existing security options for `/some/route` will be maintained, and only the `script-src` CSP directive will be modified.
328321
- The existing content of the `script-src` directive will be preserved, and your values will be added to the existing values.
329322

330323
Read more about [`defu`](https://github.com/unjs/defu)
331324

332-
333325
### Overwriting rules
334326

335327
If you want to erase the existing settings, don't use defu and overwrite the values:
336328

337329
```ts{}[server/plugins/filename.ts]
338330
export default defineNitroPlugin((nitroApp) => {
339331
nitroApp.hooks.hook('nuxt-security:routeRules', async(routeRules) => {
340-
routeRules['/some/route'] = {
332+
routeRules['/some/route'] = {
341333
headers: {
342334
contentSecurityPolicy: {
343335
"script-src": ["'self'", "..."]
@@ -349,7 +341,7 @@ export default defineNitroPlugin((nitroApp) => {
349341
})
350342
```
351343

352-
In the example above,
353-
- All existing security options for `/some/route` will be erased.
354-
- The `script-src` directive will contain your values.
344+
In the example above,
355345

346+
- All existing security options for `/some/route` will be erased.
347+
- The `script-src` directive will contain your values.

docs/content/3.middleware/4.cors-handler.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: CORS Handler
3-
description: Set roules for Cross Origin Resource Sharing.
3+
description: Set rules for Cross Origin Resource Sharing.
44
links:
55
- label: Enabled
66
icon: i-heroicons-check-badge
@@ -11,7 +11,7 @@ links:
1111
This middleware will help you set your CORS options and it is based on built in [H3 CORS](https://github.com/unjs/h3) functionality
1212

1313
::callout{icon="i-heroicons-light-bulb"}
14-
Read more about Cross Origin Resource Sharing [here](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS).
14+
Read more about Cross Origin Resource Sharing [here](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS).
1515
::
1616

1717
Testing CORS configuration can be done by running one application with NuxtSecurity enabled and creating a second application (that is running on a different port) that will send a request to the first app. Then, a CORS error could be easily observed that proves that CORS is working as expected.

0 commit comments

Comments
 (0)