nodejitsu/node-http-proxy — pull request #172 by MathieuTurcotte (2012-01-02 16:29:05+00:00)
Title: Support a path component in router's targets.

Given the following router (URL based),

```javascript
router: {
"baz.com/taco": "127.0.0.1:8098",
"biz.com": "127.0.0.1:8088/taco"
};
```

- Requests to baz.com/taco will get proxied to 127.0.0.1:8098/
- Requests to baz.com/taco/hot will get proxied to 127.0.0.1:8098/hot
- Requests to biz.com will get proxied to 127.0.0.1:8088/taco
- Requests to biz.com/foo will get proxied to 127.0.0.1:8088/taco/foo

The behavior is the same for hostname based routers. For example, given the following router (hostname based):

```javascript
router: {
"biz.com": "127.0.0.1:8013/extra",
"buz.com": "127.0.0.1:8014/mega/extra"
};
```

- Requests to biz.com/taco will get proxied to 127.0.0.1:8013/extra/taco
- Requests to buz.com/dude will get proxied to 127.0.0.1:8014/mega/extra/dude
- etc.

routing-proxy-test.js contains additional examples.