nitoyon/livereloadx — pull request #9 by ngyuki (2014-04-26 11:36:55+00:00)
Title: Rewrite location header in proxy mode

Hi.

LiveReloadX on Proxy mode does not rewrite location header.
For that reason, Move to origin server with redirect.

Example for. Create `server.js` file.

```js
require('http').createServer(function(req, res){
switch (require('url').parse(req.url).pathname)
{
case '/foo.html':
res.writeHead(200, {'content-type': 'text/html'});
res.write("this is foo.html");
break;
default:
res.writeHead(302, {'location': 'http://' + req.headers.host + '/foo.html'});
break;
}
res.end();
}).listen(8080);
```

Run server, and run livereloadx on proxy mode.

```console
$ node server.js &
$ livereloadx -y http://localhost:8080/ -p 8888
```

Open `http://localhost:8888/` on browser.

```console
$ open http://localhost:8888/
```

I hope redirect to `http://localhost:8888/foo.html`, but will be redirect to `http://localhost:8080/foo.html`.

I tried to modified to rewrite location header on proxy mode.
Would you mind review this code?