Here is the code snippet I am currently using:
const securityHeaders = [
{
key: 'X-XSS-Protection',
value: '1; mode=block'
},
{
key: 'Referrer-Policy',
value: 'origin-when-cross-origin'
}
]
module.exports = {
async headers() {
return [
{
// Apply these headers to all routes in your application.
source: '/:path*{/}?',
headers: securityHeaders,
},
]
},
}
However, after executing npm run start
and checking the Response Headers for localhost, none of these headers are appearing.
I am using version 9.5.2 of Next.js