mirror of
https://github.com/http-party/node-http-proxy.git
synced 2025-12-08 20:59:18 +00:00
pathnameOnly option documented in the Readme.md
This commit is contained in:
parent
46b078a98d
commit
a1607c1684
18
README.md
18
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].
|
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
|
### 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:
|
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:
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user