背景
webpack+vue项目做本地测试localhost跨域proxy时,遇到登陆成功且浏览器塞入cookie但是cookie确带不过去,set-cookie有warning显示This set-cookie was blocked because its domain attribute was invalid with regards to the curent host url。
修改cookieDomainRewrite来解决
devServer: {
port: port,
open: true,
overlay: {
warnings: false,
errors: true
},
proxy: {
"/report": {
target: "http://api.bilibili.com",
changeOrigin:true,
cookieDomainRewrite: "localhost"
}
}