Configuring Proxy

Some enterprise networks are configured with a Proxy Server when accessing the Internet. The SDA Connectivity Service complies with this scenario, but an extra configuration step is needed.

Pre-requisite: proxy is configured in the OS

If the host operating system is already configured with a proxy and the SDA Gateway installation succeeded, jump straight to Configure proxy in the Connectivity Client.

This requisite can be tested by looking up the environment variables that contain the address of the proxy server. In a terminal session, try echoing these variables:

$ echo HTTP_PROXY=$HTTP_PROXY \
     HTTPS_PROXY=$HTTPS_PROXY \
     ALL_PROXY=$ALL_PROXY \
     http_proxy=$http_proxy \
     https_proxy=$https_proxy \
     all_proxy=$all_proxy

If any of them exists, proxy is already configured. If not, follow this guideline to configure it globally.

Mind that a proxy address has one of the formats:

http://<proxy-address>:<port-number>
http://<username>:<password>@<proxy-address>:<port-number>

Configure proxy in the Connectivity Client

The connectivity client needs to be extra configured for proxies, as this is going to imply on the way that the application starts and connects to our IoT Broker.

Once the client is installed, the sda-gateway CLI can be used to configure proxy:

$ sudo sda-gateway proxy set --help
>> Usage: sda-gateway proxy set [OPTIONS]
>> 
>>   Set the proxy configuration
>> 
>> Options:
>>   -t, --type [http|https|socks4|socks5]
>>                                   Proxy protocol type  [required]
>>   -h, --host TEXT                 Proxy host  [required]
>>   -p, --port INTEGER              Proxy port  [required]
>>   -u, --username TEXT             Proxy username
>>   -w, --password TEXT             Proxy password
>>   --help                          Show this message and exit.

As an example:

$ sudo sda-gateway proxy set -t http -h sdaproxy.io -p 8080 -u sdauser -w sdapwd
$ sudo sda-gateway proxy get
>> http://sdauser:sdapwd@sdaproxy.io:8080

For unsetting proxy, run:

$ sudo sda-gateway proxy delete

After changing any proxy configuration, the application services needs to be restarted:

$ sudo systemctl restart sda-gateway

If the application is not restarted after configuring proxy, changes may not be effective.

Last updated