vue-cross domain problem

 

Cross-domain means that the browser does not allow the source of the current page to request data from another source. Source refers to protocol, port, domain name. As long as one of these three is different, it is cross-domain.

 

My local front end is port 8080, and the back end API is 31245.

 

In index.js under config in the project, configure target as the API address and changeorigin as true.

To access

 axios.get("api/ServerInfo/ServerList")

 

 

 

 

 

Do not turn to api address troubleshooting:

1. Check whether the address in the configuration and the called address are correct

 

Guess you like

Origin www.cnblogs.com/JinweiChang/p/12710327.html