Use an HTTP/HTTPS proxy

This page describes StackState v4.5.x. The StackState 4.5 version range is End of Life (EOL) and no longer supported. We encourage customers still running the 4.5 version range to upgrade to a more recent release.

Go to the documentation for the latest StackState release.

Overview

The Agent can be configured to use a proxy for HTTP and HTTPS requests. Proxy settings can be configured in two ways:

Configured proxy settings will be used by the Agent in the following sequence:

  1. Environment variables STS_PROXY_HTTPS / STS_PROXY_HTTP

  2. Environment variables HTTPS_PROXY / HTTP_PROXY

  3. Proxy settings in the Agent configuration file.

For example, if the environment variable STS_PROXY_HTTPS="" is set and the Agent configuration file contains the proxy setting https: https://example.com:1234, the Agent will use the proxy "" for HTTPS requests to StackState.

Proxy for all Agent communication

Note that these settings will be overridden by the environment variables: STS_PROXY_HTTPS / STS_PROXY_HTTP. See proxy for communication with StackState only.

To use a proxy for all Agent communication including checks and communication with StackState, set the following environment variables:

  • HTTP_PROXY - proxy to use for all HTTP communication.

  • HTTPS_PROXY - proxy to use for all HTTPS communication.

To configure a proxy for an Agent running on Linux, add the required environment variables to the StackState Agent systemd service.

Add environment variables to the StackState Agent systemd service:

  1. Stop the service:

    sudo systemctl stop stackstate-agent.service  
  2. Edit the service:

    sudo systemctl edit stackstate-agent.service
  3. Add the environment variables below to use a proxy for Agent checks and communication with StackState - note that this setting will be overridden by the environment variables STS_PROXY_HTTPS / STS_PROXY_HTTP if they are also set:

    [Service]
    Environment="HTTP_PROXY=http://example.com:1234"
    Environment="HTTPS_PROXY=https://example.com:1234"

    You can also use a proxy only for communication with StackState.

  4. Restart the service:

    sudo systemctl start stackstate-agent.service

Remove environment variables from the StackState Agent systemd service:

  1. Stop the service:

    sudo systemctl stop stackstate-agent.service
  2. Delete the settings file:

    sudo rm /etc/systemd/system/stackstate-agent.service.d/override.conf 
  3. Restart the service:

    sudo systemctl daemon-reload
    sudo systemctl start stackstate-agent.service

Proxy for communication with StackState only

A proxy can be configured to be used only for communication between the StackState Agent and StackState. This can be set up either by using environment variables or by updating the Agent configuration file.

Environment variables

Note that these settings will override all other proxy settings either in environment variables or the Agent configuration file.

To use a proxy for communication with StackState only, set the following environment variables:

  • STS_PROXY_HTTPS - proxy to use for HTTP communication with StackState.

  • STS_PROXY_HTTP - proxy to use for HTTPS communication with StackState.

To configure a proxy for an Agent running on Linux, add the required environment variables to the StackState Agent systemd service.

Add environment variables to the StackState Agent systemd service:

  1. Stop the service:

    sudo systemctl stop stackstate-agent.service  
  2. Edit the service:

    sudo systemctl edit stackstate-agent.service
  3. Add the environment variables below to use a proxy for communication with StackState only:

    [Service]
    Environment="STS_PROXY_HTTP=http://example.com:1234"
    Environment="STS_PROXY_HTTPS=https://example.com:1234"

    You can also use a proxy for all Agent communication.

  4. Restart the service:

    sudo systemctl start stackstate-agent.service

Remove environment variables from the StackState Agent systemd service:

  1. Stop the service:

    sudo systemctl stop stackstate-agent.service
  2. Delete the settings file:

    sudo rm /etc/systemd/system/stackstate-agent.service.d/override.conf 
  3. Restart the service:

    sudo systemctl daemon-reload
    sudo systemctl start stackstate-agent.service

Agent configuration

Note that proxy settings configured using an environment variable will override any proxy setting in the Agent configuration file.

A proxy set in the Agent configuration file will be used for communication with StackState only. Checks configured on the Agent will not use this proxy for communication with external systems. To use a proxy for Agent checks and communication with StackState, see how to use a proxy for all Agent communication.

To use a proxy for communication with StackState add the following items to the Agent configuration file:

  • proxy.http - proxy to use for HTTP communication with StackState.

  • proxy.https - proxy to use for HTTPS communication with StackState.

To update the configuration file for an Agent running on Linux:

  1. Edit the Agent configuration file:

    sudo vi /etc/stackstate-agent/stackstate.yaml
  2. Uncomment the proxy settings:

    proxy:
      https: https://example.com:1234
      http: http://example.com:1234
  3. Restart the Agent.

    sudo systemctl start stackstate-agent.service

Last updated