这是我正在使用的脚本:
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,
},
]
},
}但是,当我运行npm run start并检查本地主机的响应头时,这些头都不会出现。
使用下一个版本9.5.2

发布于 2022-07-13 23:06:21
您可以使用source: "/(.*?)",或source: '/:path*',
https://stackoverflow.com/questions/72973503
复制相似问题