Configuring a corporate proxy

When daSWAG is used in a company, you probably will need to configure all tools to bypass the corporate proxy.

You can try to configure the HTTP_PROXY and HTTPS_PROXY environment variables or use a tool like Cntlm.

But this probably won’t be enough, so you will need to configure separately all the tools that are used with daSWAG.

Introduction

Supposing your proxy is defined with:

  • username
  • password
  • host
  • port

The resulting configuration is: http://username:[email protected]:port

If your use Cntlm, then your configuration would be: 127.0.0.1:3128. Otherwise, follow the next steps to configure each tool individually.

NPM configuration

Use these commands:

npm config set proxy http://username:[email protected]:port
npm config set https-proxy http://username:[email protected]:port

Or you can edit directly your ~/.npmrc file:

proxy=http://username:[email protected]:port
https-proxy=http://username:[email protected]:port
https_proxy=http://username:[email protected]:port

Yarn configuration

Use these commands:

yarn config set proxy http://username:[email protected]:port
yarn config set https-proxy http://username:[email protected]:port

Python configuration

Python does not require a proxy to work, but you will need one for his package manager pip.

To use it behind a proxy use a proxy parameter, which according to pip --help, is in the form: scheme://[user:[email protected]]proxy.server:port`

pip install --proxy http://username:[email protected]:port TwitterApi

Or, you can use environment variables:

Linux, macOS, or Unix

$ export HTTP_PROXY=http://username:[email protected]:port
$ export HTTPS_PROXY=http://username:[email protected]:port

Windows

C:\> setx HTTP_PROXY http://username:[email protected]:port
C:\> set HTTPS_PROXY=http://username:[email protected]:port

AWS Cli

Use the commands to set your environment variables:

Linux, macOS, or Unix

$ export HTTP_PROXY=http://username:[email protected]:port
$ export HTTPS_PROXY=http://username:[email protected]:port

Windows

C:\> setx HTTP_PROXY http://username:[email protected]:port
C:\> set HTTPS_PROXY=http://username:[email protected]:port

You will find additionnal details on docs.aws.amazon.com

Git configuration

Use these commands:

git config --global http.proxy http://username:[email protected]:port
git config --global https.proxy http://username:[email protected]:port

Or you can edit directly your ~/.gitconfig file:

[http]
        proxy = http://username:[email protected]:port
[https]
        proxy = http://username:[email protected]:port

Docker

Depending on your OS, you have to edit a specific file (/etc/sysconfig/docker or /etc/default/docker).

Then, you have to restart the docker service with: sudo service docker restart.

It will not apply to systemd. See this page from docker to configure the proxy.