npm / cli

the package manager for JavaScript
https://docs.npmjs.com/cli/
Other
8.48k stars 3.17k forks source link

[BUG] npm can't pick up PAC file for proxy auto-configuration #5144

Open dandalton1 opened 2 years ago

dandalton1 commented 2 years ago

Is there an existing issue for this?

This issue exists in the latest npm version

Current Behavior

In the organization I work at, for security reasons, to connect to the outside internet there's an HTTP proxy server in the middle configured with a PAC file. https://docs.microsoft.com/en-us/windows/win32/winhttp/winhttp-autoproxy-support

npm can't reach out to the registry without that configuration, so my workaround is to use a secondary reverse proxy locally, but that isn't the most optimal solution by any means.

Expected Behavior

npm should be able to pick up the pac file's location from IE's settings, read it, and use the appropriate proxy, using user default credentials if applicable (such as the case of an NTLM-based proxy server or one using Kerberos authentication).

Steps To Reproduce

  1. Install an HTTP(S) proxy server that requires Kerberos authentication.
  2. Restrict network connectivity so internet can only go through that proxy.
  3. Run npm update -g
  4. Wait for it to time out as it can't figure out that proxy.

Environment

nlf commented 2 years ago

supporting proxy auto config, as well as kerberos auth, would both be net new features for npm. we'll put it on our list, but it may take some time for us to address this.

mottersheadt commented 10 months ago

Has this been addressed yet? Very useful feature.

isasmendiagus commented 10 months ago

Hi @nlf, Any update on this? Had issues before wih PAC files

I believe a good approach would be to set a ENV variable and add support into the npm-registry-fetch?

lscorcia commented 7 months ago

+1 here. Couldn't figure out why node builds were randomly failing on new machines. Turns out it was sometimes working because people were initializing their repo at home, but it failed when the first repo init was executed at the office where we use a proxy.pac file to configure proxy settings. With the WFH people returning to the office this is going to be interesting...