前端之路_1 「多个代理时报错404」 [I'm Eleven]

90 阅读1分钟
proxyTable: {
     '/computePath':{
        target:'http://xxxxxxxxxxxxx1',
        changeOrigin:true,
        pathRewrite:{
           '/computePath':''
        },
    } ,
    '/computePath_item':{
        target:'http://xxxxxxxxxxxxx2',
        changeOrigin:true,
        pathRewrite:{
           '/computePath_item':''
        }
    } ,
},

问题:多个代理出现报错404

      代理路由名如果第一个为 computePath 那么第二个不要以 computePath 开头 ,会解析错误。

Network 请求路径正确,但是报错404,返回信息路径解析有问题。

错误实例:

         如上:

      /computePath      解析为 http://xxxxxxxxxxxxx1/computePath/...  请求正常 

       /computePath_item  解析为 http://xxxxxxxxxxxxx2/_item/...  请求失败