Skip to content

Instantly share code, notes, and snippets.

@zekesonxx
Created June 1, 2014 08:48
Show Gist options
  • Save zekesonxx/c773cc07a8fd390086a6 to your computer and use it in GitHub Desktop.
Save zekesonxx/c773cc07a8fd390086a6 to your computer and use it in GitHub Desktop.
Amusing header middleware for your Connect/Express project. Should be easily portable to other languages.
app.use(function (req, res, next) {
function atRandom (opt) {
var selected = Math.floor(Math.random()*(opt.length));
return opt[selected];
}
//amusing headers
var servers = [
'Apache',
'nginx',
'lighttpd',
'IIS',
'Unicorn',
'Mono',
'\'); DROP TABLE servers'
];
var langs = [
'PHP',
'Ruby',
'SQL',
'Node.js',
'COBOL',
'Assembly',
'Python',
'Brainfuck',
'HQ9+',
'\'); DROP TABLE x-powered-by',
'ASP.NET',
'Visual Basic 2006',
'Java'
];
res.header('Server', atRandom(servers));
res.header('X-Powered-By', atRandom(langs));
next();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment