Skip to content

Unable to use proxy authentication #572

@feuxfollets1013

Description

@feuxfollets1013

Current Behavior

I set auth-proxy address to npm proxy as following and I got invalid proxy error when I built some library.

  • npm proxy setting
https-proxy=http://id:[email protected]:18080/
proxy=http://id:[email protected]:18080/
  • error

node-pre-gyp WARN download ignoring invalid "proxy" config setting: "http://id:[email protected]:18080/"

Expected Behavior

The build process uses proxy config setting.

Additional Info

In the following code(L63), it looks like auth-proxy and 5 digits port is not taken into account.
I checked whether node-https-proxy-agent(L65) supports auth-proxy, and I guess it supports auth-proxy from this comment.

const m = proxyUrl.match(/^(?:(https?:)\/\/)?([^:]+)(?::(\d{1,4}))?\/?$/);
if (m) {
const ProxyAgent = require(m[1] === 'https:' ? 'https-proxy-agent' : 'http-proxy-agent');
const protocol = m[1] === 'https:' ? 'https:' : 'http:';
const host = m[2];
const port = +(m[3] || (protocol === 'https:' ? 443 : 80));
const agentOpts = { host, port, protocol };
agent = new ProxyAgent(agentOpts);
log.http('download', 'proxy agent configured using: "%o"', agentOpts);
} else {
log.warn('download', 'ignoring invalid "proxy" config setting: "%s"', proxyUrl);
}
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions