Created
March 4, 2015 16:29
-
-
Save lbrenman/63dbd13fab70cb6c33ca to your computer and use it in GitHub Desktop.
Overcoming Cross Site Scripting issue with Node Apps
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
// initialize app | |
function start(app, express) { | |
app.use(express.favicon(__dirname + '/public/images/favicon.ico')); //set favicon | |
var allowCrossDomain = function(req, res, next) { | |
res.header('Access-Control-Allow-Origin', '*'); | |
res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS'); | |
res.header('Access-Control-Allow-Headers', 'Content-Type, Authorization, x-requested-with, X-Titanium-Id'); | |
res.header('Access-Control-Allow-Credentials', 'true'); | |
next(); | |
}; | |
app.use(allowCrossDomain); | |
} | |
// release resources | |
function stop() { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment