鍍金池/ 問(wèn)答/數(shù)據(jù)庫(kù)  HTML  Office/ [HPM] Error occurred while trying to pro

[HPM] Error occurred while trying to proxy request

最近在用vue+express+mongodb搭建項(xiàng)目,服務(wù)器這邊是搭好了,但在前端請(qǐng)求的時(shí)候報(bào)服務(wù)器端錯(cuò)誤504
我直接訪問(wèn)127.0.0.1:3000都能獲取數(shù)據(jù);

服務(wù)器報(bào)錯(cuò):[HPM] Error occurred while trying to proxy request /goods from 127.0.0.1:8080 to http://127.0.0.1:3000/goods
這是index.js代理配置:

proxyTable: {
      '/goods': {
        target:'http://127.0.0.1:3000/goods',
        changeOrigin:true,
        pathRewrite:{
          '^goods':''
        }
      }
    }

這是前端請(qǐng)求:

http:function () {
      this.$axios.get('/goods').then((req,res)=>{
        let data = res.data;
        if(data.status === "0"){
          this.usurInfo = data.result;
        }else {
          this.usurInfo = [];
        }
      })
    }
回答
編輯回答
安于心

target:'http://127.0.0.1:3000/goods'
改為
target:'http://127.0.0.1:3000'

2018年8月19日 03:25
編輯回答
菊外人

樓主解決了嗎,我也遇到這個(gè)問(wèn)題了

2017年8月28日 06:01