node-http-proxy icon indicating copy to clipboard operation
node-http-proxy copied to clipboard

Allow any custom agent instead of just follow-redirects

Open hasnat opened this issue 7 years ago • 5 comments
trafficstars

hasnat avatar Jul 28 '18 12:07 hasnat

Codecov Report

:exclamation: No coverage uploaded for pull request base (master@a3fe02d). Click here to learn what that means. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #1285   +/-   ##
=========================================
  Coverage          ?   92.33%           
=========================================
  Files             ?        6           
  Lines             ?      313           
  Branches          ?        0           
=========================================
  Hits              ?      289           
  Misses            ?       24           
  Partials          ?        0
Impacted Files Coverage Δ
lib/http-proxy/passes/web-incoming.js 98.3% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update a3fe02d...52ac7cd. Read the comment docs.

codecov-io avatar Nov 01 '19 10:11 codecov-io

There's already an agent option, but it doesn't look like it's fully implemented. What do you think about using agent instead of httpAgent?

codebling avatar Jan 21 '22 20:01 codebling

There's already an agent option, but it doesn't look like it's fully implemented. What do you think about using agent instead of httpAgent?

you're right; agent + httpAgent certainly makes things confusing; possibly docs update to clarify better?

code wise it looks like this

http.request(options);
  ^               ^  
  |               |
httpAgent         |
                agent

e.g. lib/http-proxy/passes/web-incoming.js:125

my use case was to replace tls with custom module for https requests

hasnat avatar Jan 22 '22 18:01 hasnat

Oh, I see - this is where we could use something like e.g. axios or got instead of actually using http module's .request() with something that http.Agent, right? But httpAgent here would still need to implement the http.ClientRequest interface? So...not axios or got? Wouldn't the TLS changes have mostly been specific to the agent anyhow?

There's probably room for refactoring to provide a single configuration that allows both (e.g. hooks for creating connection and getting the stream), but it's probably moot anyhow, since this your PR is going on 4 years old, there have been no commits in almost 2 years. Perhaps a strong ping in the "New Maintainers" issue would receive a response, as indexzero does seem to still be relatively active on GitHub.

codebling avatar Jan 22 '22 20:01 codebling

thanks, your mentions probably already have alerted maintainers. let's see what's suggested.

hasnat avatar Jan 24 '22 15:01 hasnat