Skip to content

Instantly share code, notes, and snippets.

@machadogj
Created September 13, 2012 18:26
Show Gist options
  • Select an option

  • Save machadogj/3716432 to your computer and use it in GitHub Desktop.

Select an option

Save machadogj/3716432 to your computer and use it in GitHub Desktop.
var app = connect()
.use(function(req,res,next){
buffer = httpProxy.buffer(req);
next();
})
.use(connect["static"](process.cwd()))
.use(function(req, res){
//alter request here.
req.headers["host"] = host;
req.headers["authorization"] = authorizationHeader;
proxy.proxyRequest(req, res, {
target: {
https: useHttps, //or not
host: host.split(":")[0],
port: port
},
buffer: buffer
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment