通过nodejs的请求转发到后台,前端地址:http://localhost:8080   后端地址:http://localhost:8081

vue.config.js内容如下:

let proxyObj={}

proxyObj['/']={
    //websocket
    ws:false,
    target:'http://localhost:8081',
    //发送请求头host会被设置成target
    changeOrigin:true,

    //不重写请求地址
    pathRewrite:{
        '^/':'/'
    }
}



module.exports={
    devServer:{
        host:'localhost',
        port:'8080',
        proxy:proxyObj
    }
}

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-01-14
  • 2022-12-23
  • 2021-09-07
  • 2021-12-29
  • 2021-11-28
  • 2021-07-02
猜你喜欢
  • 2021-07-12
  • 2022-01-09
  • 2021-12-25
  • 2022-01-24
  • 2022-12-23
相关资源
相似解决方案