Skip to content

Instantly share code, notes, and snippets.

@gingi
Created April 1, 2013 20:18
Show Gist options
  • Save gingi/5287410 to your computer and use it in GitHub Desktop.
Save gingi/5287410 to your computer and use it in GitHub Desktop.
CORS in an Express app.
app.use(function (req, res, next) {
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Credentials', true);
res.header('Access-Control-Allow-Methods',
'GET,PUT,POST,DELETE,OPTIONS,HEAD');
res.header('Access-Control-Allow-Headers', 'Content-Type');
next();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment