Vue-cli local environment API proxy settings solve cross-domain problems

Agent has been configured

clipboard.png

ip404

clipboard.png

Mar.11,2021

pathRewrite : {
'^/api': ''
}

first, look at the / api string in the interface.

if not (there should be no error message), then / api is just a flag you set to tell the local node server to proxy the corresponding interface across domains through the / api flag.

therefore, in the proxyTable configuration item, you need to rewrite / api to ensure normal access to the interface through pathRewrite .

however, the configuration you write will add the string / api to the interface, resulting in a request for 404:

.
...
pathRewrite : {
'^/api': '/api'
}
...

the correct one should be:

...
pathRewrite : {
'^/api': ''
}
...
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bf262e-3a1af.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bf262e-3a1af.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?