Download fails behind corporate proxy
After upgrading from 1.9.14 to 1.11.1 the download of the princexml package fails with following exception:
.../[email protected]/node_modules/prince install$ node ./prince-npm.js install
.../[email protected]/node_modules/prince install: ++ checking for globally installed PrinceXML
.../[email protected]/node_modules/prince install: ++ downloading PrinceXML distribution
.../[email protected]/node_modules/prince install: -- using proxy ($http_proxy): http://www.example.com:80
.../[email protected]/node_modules/prince install: -- download: https://www.princexml.com/download/prince-15.2-alpine3.17-x86_64.tar.gz
.../[email protected]/node_modules/prince install: (node:507) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
.../[email protected]/node_modules/prince install: (Use `node --trace-warnings ...` to show where the warning was created)
.../[email protected]/node_modules/prince install: ** ERROR: failed to download: download failed: Error: connect ECONNREFUSED ::1:443
.../[email protected]/node_modules/prince install: Done
We also tried to set the proxy configuration via npm config set proxy "http://www.example.com:80". https-proxy and noproxy were set too.
Upgrading to 1.10.0 produces the same exception.
Our used environment:
- nodejs: 20.9.0
- pnpm: 8.10.5
- OS: containerimage based on node:lts-alpine3.17
If you need any further information please let me know.
That's not an issue with "prince", but an issue with Node itself. See the line:
node:507) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
Node cannot verify the SSL/TLS connection. The workaround is also given (setting the environment variable!).
The environment variable was already set (Btw. which was the reason for the warning). Even unsetting does not change the exception. After googleing a while, it seems that axios has sometimes several problems with corporate proxies. That would match to our case. After switching from request to axios the download does not work anymore.