nodejitsu/node-http-proxy — Issue #196: How do we delete some response header before sending back to Client's Browser
Author: penkween
Created: 2012-02-15 04:06:28+00:00
State: open

I am new to node.js and I am using the following sample code of a basic forward proxy. Testing this at my laptop (with Internet connection) by setting my firefox to use a local proxy at localhost: 8000 and the browser can suft the Internet without any problem.

============== A basic Forward Proxy ======================
var http = require('http'),
httpProxy = require('http-proxy');

httpProxy.createServer(function (req, res, proxy) {

////////// I think Request Header can be filtered here/////////////

proxy.proxyRequest(req, res, {
host:req.headers['host'],
port: 80
});

////////// How to filter Response Header ???? /////////////

}).listen(8000);
========================================================

My question is How do I delete some response header eg.Etag at this proxy before passing back to my browser ?

*** Middleware example below showing how to filter Response Body, but it didn't show how to filter Response Header***
https://github.com/nodejitsu/node-http-proxy/blob/master/examples/middleware/modifyResponse-middleware.js

Anyone, pls help !

Thank.