代理http
module.exports={
//...
devServer:{
proxy:{
"/api":{
target:"http://localhost:3000",
changeOrigin: true,
pathRewrite:{
"^api":""
}
}
}
}
}
代理https
默认不支持使用无效证书的https后端服务,可以改配置
module.exports={
//...
devServer:{
proxy:{
"/api":{
target:"http://localhost:3000",
changeOrigin: true,
secure:false,
pathRewrite:{
"^api":""
}
}
}
}
}