Relative forward?
Opened this issue · 1 comments
AAverin commented
I would like to use single toxy instance to throttle many different APIs.
I am trying to set up following:
proxy.all("/papyrus")
.forward("https://server1")
.poison(poisons.latency({ min: 50, max: 2000 }))
proxy.all("/gql/*")
.forward("https://server2")
Problem is, part of the url in all
is also being forwarded
Any way to forward excluding the base url in all
?
h2non commented
You can write a middleware for that route where you can rewrite and strip the incoming request path, such as:
proxy.all("/papyrus")
.use((req, res, next) => {
req.url = '/'
next()
})
.forward("https://server1")
.poison(poisons.latency({ min: 50, max: 2000 }))