Skip to content

Instantly share code, notes, and snippets.

@andrewn
Created April 4, 2013 16:58
Show Gist options
  • Save andrewn/5312079 to your computer and use it in GitHub Desktop.
Save andrewn/5312079 to your computer and use it in GitHub Desktop.
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE');
res.header('Access-Control-Allow-Headers', 'X-Requested-With, Accept, Origin, Referer, User-Agent, Content-Type, Authorization');
// intercept OPTIONS method
if ('OPTIONS' == req.method) {
res.send(200);
}
else {
next();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment