Skip to content

Instantly share code, notes, and snippets.

@xrd
Created September 9, 2010 01:33
Show Gist options
  • Save xrd/571199 to your computer and use it in GitHub Desktop.
Save xrd/571199 to your computer and use it in GitHub Desktop.
exports.setProxy = function(server,port) {
_port = parseInt( port );
_server = server;
proxy = httpProxy.HttpProxy;
}
exports.handler = function( request, response, next ) {
proxy.watch(request,response);
if( request.profile || request.session.profile ) {
request.headers[ 'X-RPX-PROFILE' ] = JSON.stringify( request.profile || request.session.profile );
}
httpProxy.proxyRequest(_port, _server, request, response);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment