Skip to content

Commit ab6ca7d

Browse files
committed
add path support
1 parent bd671dd commit ab6ca7d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

forwarder.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
var http = require('http'),
2+
url = require('url'),
23
port = process.env.PORT || 3000;
34
http.createServer(function (req, res) {
4-
res.writeHead(301, {'Location': process.env.LOCATION});
5+
var path = url.parse(req.url).pathname || "";
6+
7+
res.writeHead(301, {'Location': process.env.LOCATION + path});
58
res.end();
69
}).listen(port, function(){
710
console.log("Forwarder started on port " + port);

0 commit comments

Comments
 (0)