Skip to content

Commit a1607c1

Browse files
mikkelindexzero
authored andcommitted
pathnameOnly option documented in the Readme.md
1 parent 46b078a commit a1607c1

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

README.md

+18
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,24 @@ var options = {
202202

203203
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].
204204

205+
### Proxy requests using a 'Pathname Only' ProxyTable
206+
207+
If you dont care about forwarding to different hosts, you can redirect based on the request path.
208+
209+
``` js
210+
var options = {
211+
pathnameOnly: true,
212+
router: {
213+
'/wiki': '127.0.0.1:8001',
214+
'/blog': '127.0.0.1:8002',
215+
'/api': '127.0.0.1:8003'
216+
}
217+
}
218+
```
219+
220+
This comes in handy if you are running separate services or applications on separate paths. Note, using this option disables routing by hostname entirely.
221+
222+
205223
### Proxy requests with an additional forward proxy
206224
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:
207225

0 commit comments

Comments
 (0)