Current location - Recipe Complete Network - Complete cookbook of home-style dishes - What are the common problems of cross-domain uni-app provider?
What are the common problems of cross-domain uni-app provider?
The common problems of uni-app cross-domain access are as follows:

In the development of 1. Uniapp, cross-domain problem occurred while debugging the request interface.

2. The local server previews the page. When ajax is used to access the content of the remote server, the request will fail.

3. Cross-domain problems caused by browser homology strategy.

Solution:

1. Find the manifest.json file in the project, and add the h5 configuration "h5": {"devserver": {"port": 8080,//browser running port" disableHostCheck": true. //Set "proxy": {"/API": {"target": "http://localhost: 3000",//local server address "changeOrigin": true,//Do you want to change the domain name" pathrewrite ":{"/API ":"/API "?

2. In the request code, modify the requested URL to start with /api/.