Vue sets the interface of cross-domain adjustment to report 504, how to solve the problem

the following is the proxy I set

proxyTable: {
  "/api": {
    target: "http://192.168.2.12:8980/",// http
    changeOrigin: true,
    pathRewrite: {
      "^/api": ""// "/api" targetapi "http://40.00.100.100:3002/user/add" "/api/user/add" 
    }
  },
  

here is the interface that my ajax calls: $ajax modifies the native chain Vue.prototype.$ajax = axios

    this.$ajax.get("/api/axis2/services/otherExpenseListQueryOfficial.otherExpenseListQueryOfficialHttpSoap12Endpoint/getQuery", {
      params: {
        applier: _this.applier,
        number: _this.number,
        agency:_this.agency,
        status:_this.status,
        order:"",
        page:1,
        pageSize:_this.pageSize
      }
    })

console error: [HPM] Error occurred while trying to proxy request / axis2/services/otherExpenseListQueryOfficial.otherExpenseListQueryOfficialHttpSoap12Endpoint/getQuery?applier=&number=&agency=%E9%99%88%E5%AE%B6%E8%BE%89&status=&order=&page=1&pageSize=20 from localhost:8980 to http://192.168.2.12:8980/ (ECONNREFUSED) ( https://nodejs.org/api/errors...
browser reported error: app.js:2972 GET http://localhost:8980/api/axis2/services/otherExpenseListQueryOfficial.otherExpenseListQueryOfficialHttpSoap12Endpoint/getQuery?applier=&number=&agency=%E9%99%88%E5%AE%B6%E8%BE%89&status=&order=&page=1&pageSize=20 504 (Gateway Timeout)
dispatchXhrRequest @ app.js:2972
xhrAdapter @ app.js:2806
dispatchRequest @ app.js:3379
Promise resolved (async)
request @ app.js:3198
Axios. (anonymous function) @ app.js:3208
wrap @ app.js:3619
getsearch @ app.js:9412
click @ app.js:95812
invoker @ app.js:103617
fn._withTask.fn._withTask @ app.js:103402
app.js:9440 Error: Request failed with status code

at createError (app.js:3310)
at settle (app.js:3461)
at XMLHttpRequest.handleLoad (app.js:2871)       
May.25,2022

this belongs to the service, isn't it? Ping http://192.168.2.12:8980/?


setting proxyTable is only a solution to cross-domain problems. The request should still be required with the request path unless nginx is configured.

// 
this.$ajax.get('http://192.168.2.12:8980/api/axis2/services/otherExpenseListQueryOfficial.otherExpenseListQueryOfficialHttpSoap12Endpoint/getQuery'...

first check whether the 8980 service is enabled on 192.168.2.12 . If the service is not activated, it will be 8980 (Gateway Timeout) , ping IP does not mean 8980 port service

Menu