Vue解决跨域多个target问题(配置多个代理问题)

  devServer: {
 	publicPath: process.env.NODE_ENV === 'production'? '/production-sub-path/': '/',
    proxy: {
    	//可以配置多个代理
      '/api': {
        target: 'http://192.168.0.201:9994',
        changeOrigin: true,
        ws: true,
        pathRewrite: {
          '^/api': ''
        }
      },
      '/images': {
        target: 'http://baidu.com',
        changeOrigin: true,
        ws: true,
        pathRewrite: {
          '^/images': ''
        }
      }
    }
  },

你可能感兴趣的:(Vue)