Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save matiasinsaurralde/6f4ec1e71cfc04c12a2dcbf5cace3431 to your computer and use it in GitHub Desktop.
Save matiasinsaurralde/6f4ec1e71cfc04c12a2dcbf5cace3431 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