An idea I'm tinkering with, services that would register themselves with a reverse proxy
Start the proxy
$ node proxy.js --p 9000 --rp 9001
proxy listening on 9000
proxy registry listening on 9001
Start a client
$ node client --pp 9001 --name "foo.com" --p 8001
client listening on 8001
Registration result successful? true
Curl the proxy:
$ curl http://foo.com:9000
request successfully proxied! foo.com on port 8001
{
"user-agent": "curl/7.21.4 (universal-apple-darwin11.0) libcurl/7.21.4 OpenSSL/0.9.8r zlib/1.2.5",
"host": "foo.com:9000",
"accept": "*/*",
"x-forwarded-for": "127.0.0.1",
"x-forwarded-port": "55828",
"x-forwarded-proto": "http",
"connection": "keep-alive"
}%
Start another client but steal the route:
$ node client --pp 9001 --name "foo.com" --p 8002
client listening on 8002
Registration result successful? true
Curl the proxy again:
$ curl http://foo.com:9000
request successfully proxied! foo.com on port 8002
{
"user-agent": "curl/7.21.4 (universal-apple-darwin11.0) libcurl/7.21.4 OpenSSL/0.9.8r zlib/1.2.5",
"host": "foo.com:9000",
"accept": "*/*",
"x-forwarded-for": "127.0.0.1",
"x-forwarded-port": "55828",
"x-forwarded-proto": "http",
"connection": "keep-alive"
}%