Environment Variables

Using environment variables to establish a connection to the Qpoint Proxy is a simple and effective way to configure applications to route their traffic through the proxy. This method allows you to set proxy configurations globally or for specific applications, ensuring that all outbound traffic is properly routed and managed by the proxy.


Before starting your application, you can set the environment variables in your shell. This method applies the proxy settings for the duration of the shell session or until the variables are unset.

export http_proxy=http://proxy.example.com:10080
export https_proxy=http://proxy.example.com:10443

You can also set these variables in your shell configuration file (e.g., .bashrc, .zshrc) to make them persistent across sessions:

echo 'export http_proxy=http://proxy.example.com:10080' >> ~/.bashrc
echo 'export https_proxy=http://proxy.example.com:10443' >> ~/.bashrc
source ~/.bashrc


When running applications inside Docker containers, you can set environment variables in the Dockerfile or via the docker run command.

Dockerfile Configuration:

ENV http_proxy=http://proxy.example.com:10080
ENV https_proxy=http://proxy.example.com:10443

Docker Run Command:

docker run -e http_proxy=http://proxy.example.com:10080 -e https_proxy=http://proxy.example.com:10443 my-app


If your application supports environment variables for proxies, you can update your pod spec to set these variables:

apiVersion: v1
kind: Pod
  name: mycurlpod
  - name: curl-container
    image: curlimages/curl
    command: [ "sh" ]
    stdin: true
    tty: true
      - name: https_proxy
        value: "http://qpoint-proxy.default.svc.cluster.local:10443"
      - name: http_proxy
        value: "http://qpoint-proxy.default.svc.cluster.local:10080"

Apply the configuration:

kubectl apply -f mycurlpod.yaml


Python applications using the requests library can be configured to use the proxy with environment variables:

import requests

response = requests.get('http://example.com')

Ensure the environment variables are set before running the script:

export http_proxy=http://proxy.example.com:10080
export https_proxy=http://proxy.example.com:10443
python my_script.py


Java applications can use the java.net package to pick up proxy settings from environment variables:

System.setProperty("http.proxyHost", "proxy.example.com");
System.setProperty("http.proxyPort", "10080");
System.setProperty("https.proxyHost", "proxy.example.com");
System.setProperty("https.proxyPort", "10443");

Alternatively, you can use JVM arguments:

java -Dhttp.proxyHost=proxy.example.com -Dhttp.proxyPort=10080 -Dhttps.proxyHost=proxy.example.com -Dhttps.proxyPort=10443 -jar my-app.jar


Node.js applications can leverage the global-tunnel-ng package to utilize environment variables for proxy settings:

const globalTunnel = require('global-tunnel-ng');


Ensure the environment variables are set before running the Node.js application:

export http_proxy=http://proxy.example.com:10080
export https_proxy=http://proxy.example.com:10443
node my_app.js

Last updated