Type to search.

Proxy server connectivity using default host variables

Serverless

Elastic Cloud Serverless projects are autoscaled environments, fully managed by Elastic and available on Elastic Cloud.

Availability

  • Generally available

    This functionality is generally available and ready for production usage.

Serverless interfaces and procedures might differ from classic Elastic Stack deployments.

Stack

The Elastic Stack includes Elastic's core products such as Elasticsearch, Kibana, Logstash, and Beats.

Availability

  • Generally available

    This functionality is generally available and ready for production usage.

Unless stated otherwise on the page, this functionality is available when your Elastic Stack is deployed on Elastic Cloud Hosted, Elastic Cloud Enterprise, Elastic Cloud on Kubernetes, and self-managed environments.

This documentation corresponds to the latest patch available for each minor version. If you're not using the latest patch, check the release notes for changes.

Set environment variables on the host to configure default proxy settings. The Elastic Agent uses host environment settings by default if no proxy settings are specified elsewhere. You can override host proxy settings later when you configure the Elastic Agent and Fleet settings. The following environment variables are available on the host:

Variable Description
HTTP_PROXY URL of the proxy server for HTTP traffic.
HTTPS_PROXY URL of the proxy server for HTTPS traffic.
NO_PROXY IP addresses or domain names that should not use the proxy. Supports patterns.

The proxy URL can be a complete URL or host[:port], in which case the http scheme is assumed. An error is returned if the value is a different form.

The location where you set these environment variables is platform-specific and based on the system manager you’re using. Here are some examples to get you started. For more information about setting environment variables, refer to the documentation for your operating system.

  • For Windows services, set environment variables for the service in the Windows registry.

    This PowerShell command sets the HKLM\SYSTEM\CurrentControlSet\Services\Elastic Agent\Environment registry key, then restarts Elastic Agent:

    YAML
    $environment = [string[]]@(
      "HTTPS_PROXY=https://proxy-hostname:proxy-port",
      "HTTP_PROXY=http://proxy-hostname:proxy-port"
      )
    
    Set-ItemProperty "HKLM:SYSTEM\CurrentControlSet\Services\Elastic Agent" -Name Environment -Value $environment
    
    Restart-Service "Elastic Agent"
    
  • For Linux services, the location depends on the distribution you’re using. For example, you can set environment variables in:

    • /etc/systemd/system/elastic-agent.service for systems that use systemd to manage the service. To edit the file, run:

      Shell
      sudo systemctl edit --full elastic-agent.service
      

      Then add the environment variables under [Service]

      Ini
      [Service]
      
      Environment="HTTPS_PROXY=https://my.proxy:8443"
      Environment="HTTP_PROXY=http://my.proxy:8080"
      
    • /etc/sysconfig/elastic-agent for Red Hat-like distributions that don’t use systemd.

    • /etc/default/elastic-agent for Debian and Ubuntu distributions that don’t use systemd.

      For example:

      Shell
      HTTPS_PROXY=https://my.proxy:8443
      HTTP_PROXY=http://my.proxy:8080
      

After adding environment variables, restart the service.

Note

If you use a proxy server to download new agent versions from artifacts.elastic.co for upgrading, configure Agent binary download settings.