vue webpack 跨域代理

dev: {
  env: require('./dev.env'),
  port: 8080,
  autoOpenBrowser: false,
  assetsSubDirectory: 'static',
  assetsPublicPath: '/',
  proxyTable: {
      '/api': {
          target: 'http://10.69.205.36:8000',
          changeOrigin: true,
          pathRewrite: {
              '^/api': ''
          }
      },
      '/v1': {
          target: 'http://work.eeee.com',
          changeOrigin: true,
          pathRewrite: {
              '^/v1': '/v1'
          }
      },
      '/admin': {
          target: 'http://work.eeee.com',
          changeOrigin: true,
          pathRewrite: {
              '^/admin': '/admin'
          }
      }
  },



在模板中:

this.$http({
    url: '/v1/staff/list',
    method: 'POST',
    body: data,
    headers: headers
})

你可能感兴趣的:(vue webpack 跨域代理)