Vue index.js文件中配置请求代理

module.exports = {
  dev: {
    // Paths
    assetsSubDirectory: 'static',
    assetsPublicPath: '/',
    proxyTable: {
      '/flask-api': {
        //前端路由匹配模式
        //http:192.168.80.14:28800
        target: 'http://10.88.40.176:8766/api/',  //后端请求服务域名和端口
        changeOrigin: true,   //设置请求头
        pathRewrite: {
          '^/flask-api': '/'   //路径重写  前端/flask-api 对应 后端/
        },
      }
    },//http://10.88.40.176:8766/api
    // Various Dev Server settings   http://10.88.40.176:6020/proxy/SPMS-SERVER/app/visitor/queryVisitorHistory
    host: '0.0.0.0', // can be overwritten by process.env.HOST
    port: 8080, // can be overwritten by process.env.PORT, if 
  },

你可能感兴趣的:(Vue index.js文件中配置请求代理)