OptimalBits/redbird — pull request #4 by tcoats (2014-10-02 02:40:18+00:00)
Title: http-proxy alters req.url based on target, now not adding path prefix prematurely

Fantastic codebase!

I've been having trouble proxying with paths. This configuration works fine:

```js
proxy.register('awesomeserver.com/path', 'http://127.0.0.1:4000');
```

If I curl `http://awesomeserver.com/path/a/b/c` it does a proxy request for `/a/b/c` from port 4000 which is what I expected - a way to 'mount' another site inside a path. All requests have the path removed from them.

However if I have the following configuration:

```js
proxy.register('awesomeserver.com/path', 'http://127.0.0.1:4000/path2');
```

I expect a curl `http://awesomeserver.com/path/a/b/c` to perform a proxy request for `/path2/a/b/c`. Instead it performs a request for `/path2/path2/a/b/c`.

Having done some work with http-proxy I notice you're prefixing the req.url and passing in a target with a path - http-proxy does the prefixing itself so this is where it's doubling up.

So here's a pull-request that stops redbird adding the prefixed path. The other option to fix would be to remove the path from the target passed to http-proxy.