Bypass Proxy for Composer/NPM/Apt

Photo by Sigmund on Unsplash

Bypass Proxy for Composer/NPM/Apt

While working in a restricted on-prem network, popular package managers like Composer or NPM may not properly work. Thanks to the proxy filtering technologies at the internet gateway end.

These package managers often download files over an unencrypted HTTP connection and verify the binaries using a checksum or GPG signature. However, in some cases, it is possible to bypass the filtering by enforcing HTTPS so these tools use an encrypted connection to fetch and download artifacts.

Composer

composer config --global disable-tls
composer config --global secure-http

NPM

npm config set registry https://registry.npmjs.org/
npm config set ssl-strict=false

Apt

sed -i s/http/https/g /etc/apt/sources.list