Created
June 1, 2014 08:48
-
-
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.
This file contains 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
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