Created
May 17, 2017 15:13
-
-
Save rttomlinson/2b4ed39bc36d2aecdbc0e75a7f4c41e4 to your computer and use it in GitHub Desktop.
Basic CORS Request Headers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Set up CORS headers from client-side | |
app.use(function(req, res, next) { | |
res.header("Access-Control-Allow-Origin", "*"); | |
res.header("Access-Control-Allow-Methods", "PUT, GET, POST, DELETE, OPTIONS"); | |
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, Authorization, Access-Control-Allow-Credentials"); | |
res.header("Access-Control-Allow-Credentials", "true"); | |
next(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment