Rob--W / proxy-from-env

A Node.js library to get the proxy URL for a given URL based on standard environment variables (http_proxy, no_proxy, ...).
MIT License
52 stars 19 forks source link

no proxy url if pointing to self #5

Closed stevenvachon closed 7 years ago

stevenvachon commented 7 years ago
process.env.HTTP_PROXY = "http://proxy/";
getProxyFromUrl("http://proxy/");
//-> http://proxy/

I think that it should return undefined, since a proxy to the same proxy is redundant.

Rob--W commented 7 years ago

I agree that proxying an already-proxied URL is somewhat redundant, but I'm not going to add a special case for the situation because the requests are similar but not strictly equivalent. For example, the proxy might have a different DNS record for the referenced host name (compared to the resolved host name as seen by the client).