Vue solves cross-domain problems

        Recently I wrote a function, the interface is adjusted to the external network, and cross-domain appears. Other functions of the project are local and have no impact. On the Internet, Baidu only needs to be a proxy in vue.config.js. After that, the interface keeps reporting 404. It's a headache.

        Du Niang said that there are two reasons why the interface reported 404. First: after modifying vue.config.js, the project did not restart; second: there was a problem with the interface. But I don't have this problem (my interface can request data in postman, and I restarted the project immediately after modifying vue.config.js). Then I asked the boss for advice. Da Lao said that the configurations of different versions are different.

        This is the vue-cli2.0 scaffolding. The proxy configuration is configured in index.js in the config folder.

 In vue-cli3.0, it must be configured in vue.config.js.

 

Guess you like

Origin blog.csdn.net/m0_45218136/article/details/126459803