Commit bdbb1897 authored by 何硕's avatar 何硕

测试跨域

parent d369dc34
...@@ -3,6 +3,16 @@ var http = require('http').createServer(app); ...@@ -3,6 +3,16 @@ var http = require('http').createServer(app);
var axios = require('axios'); var axios = require('axios');
var io = require('socket.io')(http); var io = require('socket.io')(http);
//跨域CORS设置
app.use((req, res, next) => {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Methods", "*");
res.header("Access-Control-Allow-Credentials", "true");
res.header("Access-Control-Allow-Headers", "Content-Type,Access-Token,adminid");
res.header("Access-Control-Expose-Headers", "*");
next();
});
// var BaseUrl = "http://localhost/api/"; // var BaseUrl = "http://localhost/api/";
var BaseUrl = "https://zhibo.xueyoubangedu.com/api/"; var BaseUrl = "https://zhibo.xueyoubangedu.com/api/";
// var BaseUrl = "https://live.xueyoubangedu.com/api/"; // var BaseUrl = "https://live.xueyoubangedu.com/api/";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment