"h5" : {"devServer" : {"port" : 8080, //浏览器运行端口"disableHostCheck" : true, //设置跳过host检查"proxy" : {"/api" : {"target" : "http://localhost:3000", //目标接口域名"changeOrigin" : true, //是否跨域"secure" : false, // 设置支持https协议的代理"pathRewrite":{"^/api":""}}}}}
业务请求代码:
get请求{{text}}
效果如下:
module.exports = {devServer:{port:'8080',disableHostCheck:true,proxy:{'/api':{target:'http://localhost:3000',changeOrigin:true,pathRewrite:{'^/api': ''}}}}}
目录位置: