http-party / node-http-proxy

A full-featured http proxy for node.js
https://github.com/http-party/node-http-proxy
Other
13.89k stars 1.97k forks source link

Can url-encoding of proxied path be made optional? #725

Open smill01 opened 9 years ago

smill01 commented 9 years ago

In http-proxy.js around line 241, url.parse is used to extract the request path: outgoing.path = url.parse(req.url).path; For example, an URL like /xxx/Tenant('xxx') is proxied as /xxx/Tenant(%27xxx%27).

We have consumers that cannot handle the encoded URL, and I cannot find a way to monkey-patch that method. Would it be possible to make this encoding optional? Use req.path in that case instead?

indexzero commented 9 years ago

I think you are using an older version of http-proxy since that line number doesn't exist. Based on the variable name I believe the code in question is now located here.

We would accept a pull-request that:

  1. Accepted an optional urlParser option to new HttpProxy instances, defaulting to url.parse
  2. Passed that to setupOutgoing in the options parameter
  3. Used that parameter instead of url.parse.