Commit 04cb8f8d authored by ganjingcun's avatar ganjingcun

remove CORS

parent 89002b2f
...@@ -16,17 +16,17 @@ app.set('views', path.join(__dirname, 'views')); ...@@ -16,17 +16,17 @@ app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade'); app.set('view engine', 'jade');
//allow custom header and CORS //allow custom header and CORS
app.all('*', function (req, res, next) { // app.all('*', function (req, res, next) {
res.header('Access-Control-Allow-Origin', '*'); // res.header('Access-Control-Allow-Origin', '*');
// res.header('Access-Control-Allow-Headers', 'Content-Type, Content-Length, Authorization, Accept, X-Requested-With , yourHeaderFeild'); // // res.header('Access-Control-Allow-Headers', 'Content-Type, Content-Length, Authorization, Accept, X-Requested-With , yourHeaderFeild');
res.header('Access-Control-Allow-Methods', 'PUT, POST, GET, DELETE, OPTIONS'); // res.header('Access-Control-Allow-Methods', 'PUT, POST, GET, DELETE, OPTIONS');
if (req.method == 'OPTIONS') { // if (req.method == 'OPTIONS') {
res.send(200); // res.send(200);
} // }
else { // else {
next(); // next();
} // }
}); // });
// uncomment after placing your favicon in /public // uncomment after placing your favicon in /public
//app.use(favicon(path.join(__dirname, 'public', 'favicon.ico'))); //app.use(favicon(path.join(__dirname, 'public', 'favicon.ico')));
......
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