Skip to content

Instantly share code, notes, and snippets.

@mrajagopal
Last active August 23, 2016 02:48
Show Gist options
  • Save mrajagopal/fef60bf8dc6e053e148a to your computer and use it in GitHub Desktop.
Save mrajagopal/fef60bf8dc6e053e148a to your computer and use it in GitHub Desktop.
LineRate's Node.js script to modify the HTTP response header
"use strict";
var vsm = require('lrs/virtualServerModule');
var requestHandler = function(servReq, servResp, next){
servReq.on('response', function responseHandler(cliResp){
cliResp.bindHeaders(servResp);
servResp.removeHeader("Server");
servResp.removeHeader("X-Powered-By");
servResp.setHeader("Via", "1.1 LineRate");
cliResp.pipe(servResp);
});
next();
}
vsm.on('exist', 'myVirtualServer', function(vs) {
console.log('myVirtualServer started');
vs.on('request', requestHandler);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment