Saturday, 24 August 2013

hostname + path based proxy routing using nodejitsu/node-http-proxy ( nodejs )

hostname + path based proxy routing using nodejitsu/node-http-proxy (
nodejs )

I am in the process of setting up a blog ( foo.com/blog ) ,as well as a
homepage ( foo.com ) for my domain foo.com , I am using
nodejitsu/node-http-proxy for this and nodejs on a windows 2003 server.
I plan to run 3 individual nodejs processes for this. The first one being
the proxy which will route the request to local nodes on 83 and 82.
However with the below options routing table , even if I goto foo.com/blog
or foo.com , it always directs to foo.com on 82. Why is this happening ,
or does this particular nodejitsu/node-http-proxy consider only the
hostname ?
var http = require('http'),
httpProxy = require('http-proxy');
var options = {
router: {
'foo.com/blog': '127.0.0.1:83',
'foo.com': '127.0.0.1:82'
}
};
var proxyServer = httpProxy.createServer(options);
proxyServer.listen(80);

No comments:

Post a Comment