From fc67fc737c826b5317e1a6ec1c0416526372a317 Mon Sep 17 00:00:00 2001 From: Sam Robbins Date: Tue, 22 Jun 2021 09:54:53 +0100 Subject: [PATCH] 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 --- docs/advanced-features/security-headers.md | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/docs/advanced-features/security-headers.md b/docs/advanced-features/security-headers.md index db5be67f1ebaa..1fe223855cb70 100644 --- a/docs/advanced-features/security-headers.md +++ b/docs/advanced-features/security-headers.md @@ -11,16 +11,18 @@ To improve the security of your application, you can use [`headers`](/docs/api-r // You can choose which headers to add to the list // after learning more below. -const securityHeaders = []; - -async headers() { - return [ - { - // Apply these headers to all routes in your application. - source: '/(.*)', - headers: securityHeaders - } - ] +const securityHeaders = [] + +module.exports = { + async headers() { + return [ + { + // Apply these headers to all routes in your application. + source: '/(.*)', + headers: securityHeaders, + }, + ] + }, } ```