When the proxy is configured, why still report the error of cross-domain request?

this is my own service run with nodejs. You can visit

.

clipboard.png
:

clipboard.png
:

clipboard.png
server.js

clipboard.png
still report the same error ("^") ("^")

Mar.01,2021

your access to port 8081 services on port 8080 must be cross-domain. If you need to set some protocol headers, you can access


header ('Access-Control-Allow-Origin: *'); / / allow all sources to access
header ('Access-Control-Allow-Methods: POST'); / / response type


how to write the url you requested. It looks like your url directly wrote port 8081, or the agent did not take effect


summarize how to solve this problem:
1. If the url of the request is misspelled, you should write axios.get ('/ getRecommend); instead of axios.get ('127.0.0.1 getRecommend); 8081 GetRecommend');
2. The server.js on the server needs to set the protocol header
/ / Cross-domain setting
app.all ('*', function (req, res, next) {
res.send ("recommended data");
res.header ("Access-Control-Allow-Credentials", true)
res.header ("Access-Control-Allow-Origin", "*")
res.header ("Access-Control-Allow-Headers", "X-Requested-With")
res.header ("Access-Control-Allow-Methods", "PUT,POST,GET,DELETE,OPTIONS")
res.header ("X-Powered-By", '3.2.1')
res.header ("Content-Type", "application/json;") Charset=utf-8 ")
next ()
})
3. Add a timestamp
axios.get ('/ getRencomment+time='+new Date (). GetTime ());

) to the url of the request
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-1be3cc3-45c39.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-1be3cc3-45c39.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?