cross-domain problem effective solution

User Question: Use the Vue-CLI this scaffolding tool. How to configure cross-domain this in the development environment. However, after using NPM Run Build, the cross-domain request URL of the Ajax inside has become a root directory.

How to solve the deployed cross-domain problem?

An error message:

Access to XmlhttpRequest at ‘ = polling & t = N0oqNsW ‘from origin’ http: // localhost: 8080 ‘has been blocked by CORS policy: No’ Access-Control-Allow-Origin ‘header is present on the requested resource

. Vue-socketio.js? 70bb: 8 get net :: err_failed

Solution :

// vue.config.jsmodule.exports = {DevServer: {proxy: {‘/’: {target: ‘http: / / ‘, ws: true, changeorigin: true},’ sockjs-node ‘: {Target: ‘’, ws: false, changeorigin: true},}}}

The above is TUMI Yun Xiaobian finishing Related knowledge points, I hope to help everyone.
© Copyright Notice
Just support it if you like
comment Grab the couch

Please log in to comment