I have many of these "controllers":
app.get('/',function(req,res){
var stuff = { 'title': 'blah' };
res.render('mytemplate',stuff);
});
Notice res.render? I want to add this header to every response header I make:
X-XSS-Protection: 0
How can I add that response header automatically?
// global controller
app.get('/*',function(req,res,next){
res.header('X-XSS-Protection' , 0 );
next(); // http://expressjs.com/guide.html#passing-route control
});
Just make sure this is the first controller you add, order is significant.
You probably want to use app.use with your own middleware:
app.use(function(req, res, next) {
res.header('X-XSS-Protection', 0);
next();
});