The specific problems when vue.js sets the proxy to call the backend API are as follows:

$ajax calls the backend local API and writes localhost:8080 directly can be called successfully

the browser console has the data of my console call indicating that it is successful.

then I set up the agent in config/index.js
to report an error. The error figure is as follows:

what is this problem and how to solve it?


it's the previous match / api that includes the match of / api3. Then change the address.

proxyTable: {
    '/api/': {},
    '/api3/': {}
}
< hr >

I didn't see the original answer to the question.
just get rid of the pathRewrite. When configuring this field, all / api3 in URL will be replaced when requested (you have an empty string here.
or just fill it in like this.

http://localhost</a>:8080

pathRewrite: {

'^/api3': '/'

}

Menu