Skip to content

Instantly share code, notes, and snippets.

@Marak
Forked from xrd/gist:571199
Created September 9, 2010 01:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Marak/571216 to your computer and use it in GitHub Desktop.
Save Marak/571216 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