Proxy Settings

Linux

run exec $SHELL -l after the following setting to make the changes effect
use %5C instead of \
change <domainshortname>, <username>, <password>, <proxyhost>, <proxyport> into real value
if your proxy doesn’t need auth, remove the auth parts: <domainshortname>%5C<username>:<password>@

  • Common
$ sudo vi /etc/environment
export HTTP_PROXY="http://<domainshortname>%5C<username>:<password>@<proxyhost>:<proxyport>"
export HTTPS_PROXY="http://<domainshortname>%5C<username>:<password>@<proxyhost>:<proxyport>"
export NO_PROXY=192.168.0.0/16,172.16.0.0/12,10.0.0.0/8,localhost,127.0.0.0/8,fc00::/7,fe80::/10,::1

# lowcase for curl etc.
export http_proxy=http://<domainshortname>%5C<username>:<password>@<proxyhost>:<proxyport>
export https_proxy=http://<domainshortname>%5C<username>:<password>@<proxyhost>:<proxyport>
export no_proxy=192.168.0.0/16,172.16.0.0/12,10.0.0.0/8,localhost,127.0.0.0/8,fc00::/7,fe80::/10,::1

$ vi $HOME/.bashrc
export http_proxy=http://<domainshortname>%5C<username>:<password>@<proxyhost>:<proxyport>
export https_proxy=${http_proxy}
  • apt
$ sudo vi /etc/apt/apt.conf
Acquire::http::Proxy "http://<domainshortname>%5C<username>:<password>@<proxyhost>:<proxyport>"
Acquire::https::Proxy "http://<domainshortname>%5C<username>:<password>@<proxyhost>:<proxyport>"
  • wget
$ sudo vi /etc/wgetrc
http_proxy=http://<domainshortname>%5C<username>:<password>@<proxyhost>:<proxyport>
https_proxy=http://<domainshortname>%5C<username>:<password>@<proxyhost>:<proxyport>
  • curl
$ vi $HOME/.curlrc
proxy = "http://<domainshortname>%5C<username>:<password>@<proxyhost>:<proxyport>"
# no_proxy = "192.168.210.0/23, localhost, 127.0.0.0/8, 143.94.0.0/16, ifxsoft.com"
  • Snap
$ sudo snap set system proxy.http=http://<domainshortname>%5C<username>:<password>@<proxyhost>:<proxyport>
$ sudo snap set system proxy.https=http://<domainshortname>%5C<username>:<password>@<proxyhost>:<proxyport>
  • Yum
$ sudo vi /etc/yum.conf
proxy=http://<proxyhost>:<proxyport>
proxy_username=<username>
proxy_password=<password>

Git

$ git config --global http.proxy http://<domainshortname>%5C<username>:<password>@<proxyhost>:<proxyport>
$ git config --global https.proxy http://<domainshortname>%5C<username>:<password>@<proxyhost>:<proxyport>
$ git config --global http.sslverify false
$ git config --global https.sslverify false
# this is needed for proxy auth
$ git config --global http.proxyauthmethod basic
$ git config --global credential.helper store

Docker

[Environment]::SetEnvironmentVariable("HTTP_PROXY", "http://<domainshortname>%5C<username>:<password>@<proxyhost>:<proxyport>", [EnvironmentVariableTarget]::Machine)
[Environment]::SetEnvironmentVariable("HTTPS_PROXY", "http://<domainshortname>%5C<username>:<password>@<proxyhost>:<proxyport>", [EnvironmentVariableTarget]::Machine)
[Environment]::SetEnvironmentVariable("NO_PROXY", "192.168.0.0/16,172.16.0.0/12,10.0.0.0/8,localhost,127.0.0.0/8,fc00::/7,fe80::/10,::1", [EnvironmentVariableTarget]::Machine)

npm

npm config set http-proxy http://<username>:<password>@<proxy-server-url>:<port> 
npm config set https-proxy http://<username>:<password>@<proxy-server-url>:<port> 

scp&ssh

scp -o "ProxyJump <proxyhost>:<proxyport>" <File-Name> <User>@<Destination-Server>:<Destination-Path>
scp -o "ProxyCommand=nc <user>@<Proxy-Server> nc %h %p" <File-Name> <User@<Destination-Server>:<Destination-Path>
ssh -o "ProxyCommand=nc -X connect -x <username>@<proxyhost>:<proxyport> %h %p" User@Destination-Server
ssh -o "ProxyCommand=nc -X connect -P <domainshortname>\\\<username> -x <proxyhost>:<proxyport> %h %p" User@Destination-Server
ssh -o "ProxyCommand=ncat --proxy <proxyhost>:<proxyport> --proxy-type http %h %p" User@Destination-Server
ssh -o "ProxyCommand=ncat --proxy-auth <username>:<password> --proxy <proxyhost>:<proxyport> --proxy-type http %h %p" User@Destination-Server

for windows

first install ncat https://nmap.org/dist/nmap-7.94-setup.exe ~/.ssh/config

Host <host>
    User <user>
    IdentityFile ~/.ssh/id_rsa
    ProxyCommand ncat --proxy-type http --proxy <proxyhost>:<proxyport> %h %p

Gradle

$ sudo vi gradle.properties
systemProp.http.proxyHost=<proxyhost>
systemProp.http.proxyPort=<proxyport>
systemProp.https.proxyHost=<proxyhost>
systemProp.https.proxyPort=<proxyport>
systemProp.http.nonProxyHosts=localhost|127.0.0.1
systemProp.https.nonProxyHosts=localhost|127.0.0.1

Java

$ java -dhttp.proxyHost=<proxyhost> \
 -dhttp.proxyPort=<proxyport> \
 -dhttps.proxyHost=<proxyhost> \
 -dhttps.proxyPort=<proxyport> \
 -dhttp.nonProxyHosts=localhost|127.0.0.1 \
 -dhttps.nonProxyHosts=localhost|127.0.0.1