Home > front end >  Cross-domain configuration proxy configuration
Cross-domain configuration proxy configuration

Time:12-14

When using the vue - cli,
Axios across requests
, please down who know cross-domain file configuration, detailed

CodePudding user response:

Vue. Config. Js

 
The module. Exports={
DevServer: {
Proxy: {
'/API: {
Target: 'http://127.0.0.1:8101',
PathRewrite: {
'^/API' : '/API'
}
},

},
Port: 80
}
}

CodePudding user response:

Cross-domain, need to modify the service side, add the Access to the header - Control - Allow - Origin project

CodePudding user response:

Vie - cli3 created project not own now need to configure the configuration file in the root directory to create a new vue. Config. Js

Content
 
The module. Exports={
DevServer: {
Port: 80,
DisableHostCheck: true,
Host: '0.0.0.0'
WatchOptions: {
AggregateTimeout: 300,
Poll: 1000
},
Proxy: {
"/API" : {
Target: "http://xxxxxx",
PathRewrite: {
"^/API" : ""
}
},
}
}
}
  •  Tags:  
  • Ajax
  • Related