nsimmons / koa-better-http-proxy

Proxy middleware for Koa. Based on villadora/express-http-proxy
Other
119 stars 42 forks source link

Cannot proxy URL's starting with a specific path to a host. #23

Open claudionunezjr opened 5 years ago

claudionunezjr commented 5 years ago

In the express version of this repository, https://github.com/villadora/express-http-proxy#example, it's possible to do this: app.use('/proxy', proxy('www.google.com')); In Koa, this is not possible. I've set up a koa-router to handle this, but it's not working as expected.

Let's say I set up a GET route to "/proxy" with the second parameter being the proxy to said host. That URL will now be active, but it actually points to (using the above example) "google.com/proxy", not "google.com/" as one would expect a proxy to work, and indeed does work in the express example.

Can the behavior that exists in the express example be replicated using the Koa version of this tool?