Skip to content

Commit fc67fc7

Browse files
authored
Add module.exports to security headers documentation (#26466)
Without `module.exports`, the provided code won't work if just pasted into `next.config.js` ## Documentation / Examples - [x] Make sure the linting passes
1 parent 562640d commit fc67fc7

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

docs/advanced-features/security-headers.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,18 @@ To improve the security of your application, you can use [`headers`](/docs/api-r
1111

1212
// You can choose which headers to add to the list
1313
// after learning more below.
14-
const securityHeaders = [];
15-
16-
async headers() {
17-
return [
18-
{
19-
// Apply these headers to all routes in your application.
20-
source: '/(.*)',
21-
headers: securityHeaders
22-
}
23-
]
14+
const securityHeaders = []
15+
16+
module.exports = {
17+
async headers() {
18+
return [
19+
{
20+
// Apply these headers to all routes in your application.
21+
source: '/(.*)',
22+
headers: securityHeaders,
23+
},
24+
]
25+
},
2426
}
2527
```
2628

0 commit comments

Comments
 (0)