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 18 forks source link

Support for mixed protocol proxies and urls #21

Open heathdbrown opened 1 year ago

heathdbrown commented 1 year ago

An environment may have a 'plain' http://proxy.example:80 only and need to send a https://example.com url through.

We hit this when attempting to use puppeteer which utilizes this library to gather the proxy.

The 'shouldProxy' function looks to take into account that both ports match up to set the proxy which results in non proxied traffic and a failure http status code 400 to occur. Proxies expect a 'CONNECT' for the https traffic.