前端增加代理解决,这个其实应该后端解决的

  • 修改config/index.js(基于Vue-CLI2)
  • 增加proxyTable

 

module.exports = {
  dev: {
    // proxyTable: proxyConfig.proxyList, // 无效,不使用,20190422
    proxyTable: {
      '/api': {
          target: 'http://localhost:8830',//后端接口地址
          changeOrigin: true,//是否允许跨越
          pathRewrite: {
              '^/api': '/api',//重写,
          }
      }
    },


} }

  

相关文章:

  • 2021-08-17
  • 2021-06-26
  • 2021-08-31
  • 2022-03-02
  • 2022-12-23
  • 2021-09-10
  • 2022-03-08
猜你喜欢
  • 2022-02-01
  • 2022-12-23
  • 2022-12-23
  • 2021-08-13
  • 2022-12-23
  • 2021-10-15
  • 2021-06-29
相关资源
相似解决方案