From a1607c1684a7d7617e5148a0dca882eb08a9f03b Mon Sep 17 00:00:00 2001 From: Mikkel Garcia Date: Tue, 5 Mar 2013 17:32:49 -0700 Subject: [PATCH] pathnameOnly option documented in the Readme.md --- README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/README.md b/README.md index c13f9bc..33c27dc 100644 --- a/README.md +++ b/README.md @@ -202,6 +202,24 @@ var options = { Notice here that I have not included paths on the individual domains because this is not possible when using only the HTTP 'Host' header. Care to learn more? See [RFC2616: HTTP/1.1, Section 14.23, "Host"][4]. +### Proxy requests using a 'Pathname Only' ProxyTable + +If you dont care about forwarding to different hosts, you can redirect based on the request path. + +``` js +var options = { + pathnameOnly: true, + router: { + '/wiki': '127.0.0.1:8001', + '/blog': '127.0.0.1:8002', + '/api': '127.0.0.1:8003' + } +} +``` + +This comes in handy if you are running separate services or applications on separate paths. Note, using this option disables routing by hostname entirely. + + ### Proxy requests with an additional forward proxy Sometimes in addition to a reverse proxy, you may want your front-facing server to forward traffic to another location. For example, if you wanted to load test your staging environment. This is possible when using node-http-proxy using similar JSON-based configuration to a proxy table: