DestinyHunter / DestinyHunter.github.io

Blog
https://DestinyHunter.cn
1 stars 0 forks source link

vue-cli 配置本地反向代理解决跨域 #7

Open DestinyHunter opened 6 years ago

DestinyHunter commented 6 years ago

/config/index.js proxyTable 配置代理

 proxyTable: {
      '/api': {
        target: 'http://api.xxx.com',
        changeOrigin: true,
        pathRewrite: {
            '^/api': ''
        },
      },
      '/upload': {
        target: 'http://api.xxx.com/upload',
        changeOrigin: true,
        pathRewrite: {
            '^/upload': ''
        }
      }
    },