[英]Cannot add response headers
這是我正在使用的腳本:
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
並檢查 localhost 的響應標頭時,這些標頭都沒有出現。
使用下一個版本 9.5.2
您可以使用source: "/(.*?)",
或source: '/:path*',
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.