Installation

Install HAProxy Data Plane API on HAProxy Enterprise

This section describes how to install HAProxy Data Plane API on HAProxy Enterprise.

HAProxy Data Plane API and HAProxy Fusion

If your load balancer is managed by HAProxy Fusion, use HAProxy Fusion API instead of HAProxy Data Plane API. HAProxy Fusion installs and uses HAProxy Data Plane API on load balancer nodes that it manages. Don’t reinstall HAProxy Data Plane API on nodes managed by HAProxy Fusion.

Version 3.0 contains breaking changes

If you’re installing HAProxy Data Plane API 3.x, know that it changes several conventions that were present in version 2.x, and that upgrading to 3.x will require you to call the API endpoints differently. See the release notes for more details.

Run the API using systemd Jump to heading

When you run HAProxy Enterprise on Linux, you must install HAProxy Data Plane API as an additional step. The API then runs as a systemd service.

  1. Install HAProxy Data Plane API x86-64 package.

    Install the software
    nix
    sudo apt-get install hapee-extras-dataplaneapi33
    nix
    sudo apt-get install hapee-extras-dataplaneapi33
    nix
    sudo yum install hapee-extras-dataplaneapi33 --allowerasing
    nix
    sudo yum install hapee-extras-dataplaneapi33 --allowerasing
    nix
    sudo zypper install hapee-extras-dataplaneapi33
    nix
    sudo zypper install hapee-extras-dataplaneapi33
    nix
    sudo pkg install hapee-extras-dataplaneapi33
    nix
    sudo pkg install hapee-extras-dataplaneapi33
    nix
    sudo apt-get install hapee-extras-dataplaneapi32
    nix
    sudo apt-get install hapee-extras-dataplaneapi32
    nix
    sudo yum install hapee-extras-dataplaneapi32 --allowerasing
    nix
    sudo yum install hapee-extras-dataplaneapi32 --allowerasing
    nix
    sudo zypper install hapee-extras-dataplaneapi32
    nix
    sudo zypper install hapee-extras-dataplaneapi32
    nix
    sudo pkg install hapee-extras-dataplaneapi32
    nix
    sudo pkg install hapee-extras-dataplaneapi32
    nix
    sudo apt-get install hapee-extras-dataplaneapi31
    nix
    sudo apt-get install hapee-extras-dataplaneapi31
    nix
    sudo yum install hapee-extras-dataplaneapi31 --allowerasing
    nix
    sudo yum install hapee-extras-dataplaneapi31 --allowerasing
    nix
    sudo zypper install hapee-extras-dataplaneapi31
    nix
    sudo zypper install hapee-extras-dataplaneapi31
    nix
    sudo pkg install hapee-extras-dataplaneapi31
    nix
    sudo pkg install hapee-extras-dataplaneapi31
    nix
    sudo apt-get install hapee-extras-dataplaneapi30
    nix
    sudo apt-get install hapee-extras-dataplaneapi30
    nix
    sudo yum install hapee-extras-dataplaneapi30 --allowerasing
    nix
    sudo yum install hapee-extras-dataplaneapi30 --allowerasing
    nix
    sudo zypper install hapee-extras-dataplaneapi30
    nix
    sudo zypper install hapee-extras-dataplaneapi30
    nix
    sudo pkg install hapee-extras-dataplaneapi30
    nix
    sudo pkg install hapee-extras-dataplaneapi30
    nix
    sudo apt-get install hapee-extras-dataplaneapi29
    nix
    sudo apt-get install hapee-extras-dataplaneapi29
    nix
    sudo yum install hapee-extras-dataplaneapi29 --allowerasing
    nix
    sudo yum install hapee-extras-dataplaneapi29 --allowerasing
    nix
    sudo zypper install hapee-extras-dataplaneapi29
    nix
    sudo zypper install hapee-extras-dataplaneapi29
    nix
    sudo pkg install hapee-extras-dataplaneapi29
    nix
    sudo pkg install hapee-extras-dataplaneapi29
  2. Ensure that your HAProxy Enterprise configuration has a stats socket line in the global section; this enables the HAProxy Runtime API. HAProxy Data Plane API integrates with the Runtime API to make some configuration changes without needing to reload the load balancer.

    hapee-lb.cfg
    haproxy
    global
    stats socket /var/run/hapee-3.3/hapee-lb.sock user hapee-lb group hapee mode 660 level admin expose-fd listeners
    hapee-lb.cfg
    haproxy
    global
    stats socket /var/run/hapee-3.3/hapee-lb.sock user hapee-lb group hapee mode 660 level admin expose-fd listeners
  3. Configure the Basic authentication credentials you’ll use to access the API by setting the username and password in the HAProxy Data Plane API configuration file, /etc/hapee-extras/dataplaneapi.yml. Add a user block to the HAProxy Data Plane API configuration file, and set the password with the password field. If you set insecure to true, set a cleartext password. If you set insecure to false, set an MD5, SHA-256, or SHA-512 hash of the password.

    Configuration file on versions <= 2.7

    For HAProxy Data Plane API version 2.7 and older, the configuration file is named /etc/hapee-extras/dataplaneapi.hcl. It uses the HCL syntax.

    dataplaneapi.yml
    yaml
    dataplaneapi:
    user:
    - name: admin
    insecure: true
    password: adminpwd
    dataplaneapi.yml
    yaml
    dataplaneapi:
    user:
    - name: admin
    insecure: true
    password: adminpwd
  4. Enable and restart the service:

    nix
    sudo systemctl enable hapee-extras-dataplaneapi
    sudo systemctl restart hapee-extras-dataplaneapi
    nix
    sudo systemctl enable hapee-extras-dataplaneapi
    sudo systemctl restart hapee-extras-dataplaneapi

Run the API in Docker Jump to heading

Prerequisite

Run HAProxy Enterprise as a Docker container. It hosts HAProxy Data Plane API.

When you run HAProxy Enterprise as a Docker container, HAProxy Data Plane API is included and listens at port 5555. The username and password for accessing it are defined in the file hapee-extras/dataplaneapi.yml.

Configuration file on versions <= 2.7

For HAProxy Data Plane API version 2.7 and older, the configuration file is named /etc/hapee-extras/dataplaneapi.hcl. It uses the HCL syntax.

  1. Find the user configuration section inside the dataplaneapi.yml file.

    Example:

    dataplaneapi.yml
    yaml
    user:
    - insecure: true
    password: v7xkLr4Z4Qlc
    name: admin
    dataplaneapi.yml
    yaml
    user:
    - insecure: true
    password: v7xkLr4Z4Qlc
    name: admin
  2. Verify that the API is working by calling the info endpoint. In the example below, we use the username and password that we retrieved during the last step.

    nix
    curl --request GET --user admin:v7xkLr4Z4Qlc http://localhost:5555/v3/info
    nix
    curl --request GET --user admin:v7xkLr4Z4Qlc http://localhost:5555/v3/info
    output
    json
    {"api":{"build_date":"2025-07-11T15:43:53.000Z","version":"v3.0.12-ee2 b3359a8f"},"system":{}}
    output
    json
    {"api":{"build_date":"2025-07-11T15:43:53.000Z","version":"v3.0.12-ee2 b3359a8f"},"system":{}}

Change the password Jump to heading

To change the password you use to access the API:

  1. Edit dataplaneapi.yml and change the password in the user block. If you set insecure to true, set a cleartext password. If you set insecure to false, set an MD5, SHA-256, or SHA-512 hash of the password.

    dataplaneapi.yml
    yaml
    user:
    - name: admin
    insecure: true
    password: adminpwd
    dataplaneapi.yml
    yaml
    user:
    - name: admin
    insecure: true
    password: adminpwd
  2. Restart the service or Docker container:

    nix
    sudo systemctl restart hapee-extras-dataplaneapi
    nix
    sudo systemctl restart hapee-extras-dataplaneapi
    nix
    sudo docker restart <NAME OF HAPROXY ENTERPRISE CONTAINER>
    nix
    sudo docker restart <NAME OF HAPROXY ENTERPRISE CONTAINER>
  3. Verify that the API is working by calling the info endpoint with the new password.

    nix
    curl --request GET --user admin:adminpwd http://localhost:5555/v3/info
    nix
    curl --request GET --user admin:adminpwd http://localhost:5555/v3/info
    output
    json
    {"api":{"build_date":"2025-07-11T15:43:53.000Z","version":"v3.0.12-ee2 b3359a8f"},"system":{}}
    output
    json
    {"api":{"build_date":"2025-07-11T15:43:53.000Z","version":"v3.0.12-ee2 b3359a8f"},"system":{}}

Change the IP address and port Jump to heading

By default, HAProxy Data Plane API listens on all IP addresses at TCP port 5555. You can change the listening IP address and port by editing the HAProxy Data Plane API configuration file.

  1. Change the host and/or port fields in the dataplaneapi block.

    This example changes the host to 192.168.50.20 and the port from its default of 5555 to 5557.

    dataplaneapi.yml
    yaml
    dataplaneapi:
    host: 192.168.50.20
    port: 5557
    dataplaneapi.yml
    yaml
    dataplaneapi:
    host: 192.168.50.20
    port: 5557

    Alternatively, set the HOST and PORT environment variables. If you’re running the API as a systemd service, add those variables to the following file, which the service reads at startup:

    • On Debian/Ubuntu, /etc/default/hapee-extras-dataplaneapi
    • On Alma/Oracle/Red Hat/Rocky, /etc/sysconfig/hapee-extras-dataplaneapi
    hapee-extras-dataplaneapi
    ini
    HOST=192.168.50.20
    PORT=5557
    hapee-extras-dataplaneapi
    ini
    HOST=192.168.50.20
    PORT=5557
  2. Restart the service or Docker container:

    nix
    sudo systemctl restart hapee-extras-dataplaneapi
    nix
    sudo systemctl restart hapee-extras-dataplaneapi
    nix
    sudo docker restart <NAME OF HAPROXY ENTERPRISE CONTAINER>
    nix
    sudo docker restart <NAME OF HAPROXY ENTERPRISE CONTAINER>

Verify that the API works Jump to heading

To verify that the API is running properly, try calling the info API endpoint.

nix
curl --request GET --user admin:adminpwd http://localhost:5555/v3/info
nix
curl --request GET --user admin:adminpwd http://localhost:5555/v3/info
output
json
{"api":{"build_date":"2024-11-14T14:23:12.000Z","version":"v3.0.3-ee1 3b84e390"},"system":{}}
output
json
{"api":{"build_date":"2024-11-14T14:23:12.000Z","version":"v3.0.3-ee1 3b84e390"},"system":{}}

If you get a permission denied error:

output
json
{"code":500,"message":"dial unix /var/run/hapee-3.3/hapee-lb.sock: connect: permission denied"}
output
json
{"code":500,"message":"dial unix /var/run/hapee-3.3/hapee-lb.sock: connect: permission denied"}

This often means that the user who runs the API doesn’t have access to the Runtime API socket. Check that you added them to the system group hapee, log out and back in again, then try it again.

If you receive an error such as 400 Bad Request or Client sent an HTTP request to an HTTPS server, HTTPS may be enabled. Try the curl command again with the -k option and specify HTTPS in your URL:

nix
curl -k --request GET --user admin:adminpwd https://localhost:5555/v3/info
nix
curl -k --request GET --user admin:adminpwd https://localhost:5555/v3/info

Enable HTTPS Jump to heading

Using HAProxy Fusion?

For HAProxy Enterprise instances managed by HAProxy Fusion, HTTPS is enabled by default. The appropriate certificates are already in place. There is no need to change the TLS settings if your HAProxy Enterprise instance is managed by HAProxy Fusion.

To enable HTTPS for accessing HAProxy Data Plane API, you must add a tls section to your configuration file and set the scheme to https:

  1. Add the following to your HAProxy Data Plane API configuration file:

    dataplaneapi.yml
    yaml
    dataplaneapi:
    host: 0.0.0.0
    port: 5555
    scheme:
    - https
    ...
    tls:
    tls_port: 6443
    tls_certificate: /etc/hapee-3.3/certs/server-cert.pem
    tls_key: /etc/hapee-3.3/certs/server-key.pem
    ...
    dataplaneapi.yml
    yaml
    dataplaneapi:
    host: 0.0.0.0
    port: 5555
    scheme:
    - https
    ...
    tls:
    tls_port: 6443
    tls_certificate: /etc/hapee-3.3/certs/server-cert.pem
    tls_key: /etc/hapee-3.3/certs/server-key.pem
    ...

    Set the following:

    • The scheme to https. Note that you can also have an entry for http, but you must specify different ports for port and tls_port to enable both HTTP and HTTPS.
    • The port for TLS connections as tls_port. This must be a different port than you specify for port if you intend to have both HTTP and HTTPS connections active.
    • The path to the certificate file to use with TLS connections as tls_certificate. If using Docker, you’ll need to add the certs directory to the volume mount.
    • The path to the private key to use with TLS connections as tls_key.
  2. Restart the service or Docker container:

    nix
    sudo systemctl restart hapee-extras-dataplaneapi
    nix
    sudo systemctl restart hapee-extras-dataplaneapi
    nix
    sudo docker restart <NAME OF HAPROXY ENTERPRISE CONTAINER>
    nix
    sudo docker restart <NAME OF HAPROXY ENTERPRISE CONTAINER>

You can test the HTTPS connection to HAProxy Data Plane API using curl, providing your username and password that you defined in the user section during installation. The following example is for HAProxy Data Plane API 3.0 (v3):

nix
curl -k --user <username>:<password> --request GET https://localhost:6443/v3/info
nix
curl -k --user <username>:<password> --request GET https://localhost:6443/v3/info
output
json
{"api":{"build_date":"2025-01-17T17:13:45.000Z","version":"v3.0.4-ee1 d354a7ec"},"system":{}}
output
json
{"api":{"build_date":"2025-01-17T17:13:45.000Z","version":"v3.0.4-ee1 d354a7ec"},"system":{}}

You can optionally set the following properties in the tls section:

Option Description
tls_host The IP to listen on for HTTPS. If you don’t specify a value, it’s the same as host.
tls_listen_limit Limits the number of outstanding requests.
tls_keep_alive Sets the TCP keep-alive timeouts on accepted connections.
tls_read_timeout Maximum duration before timing out read operation of the request.
tls_write_timeout Maximum duration before timing out write operation of the response.
tls_ca The certificate authority file to be used with mTLS authentication. Providing this option disables basic authentication. You will need to authenticate using a client certificate and key.

Enable mTLS Jump to heading

If you need to perform client certificate authentication, also known as mTLS, for connections to HAProxy Data Plane API, you can set an additional parameter in the configuration tls_ca which sets the certificate authority with which to authenticate client certificates. To enable this behavior:

  1. Add this line to your HAProxy Data Plane API configuration which specifies the path to your CA file:

    dataplaneapi.yml
    yaml
    dataplaneapi:
    host: 0.0.0.0
    port: 5555
    scheme:
    - https
    ...
    tls:
    tls_port: 6443
    tls_certificate: /etc/hapee-3.3/certs/server-cert.pem
    tls_key: /etc/hapee-3.3/certs/server-key.pem
    tls_ca: /etc/hapee-3.3/certs/ca-cert.pem
    ...
    dataplaneapi.yml
    yaml
    dataplaneapi:
    host: 0.0.0.0
    port: 5555
    scheme:
    - https
    ...
    tls:
    tls_port: 6443
    tls_certificate: /etc/hapee-3.3/certs/server-cert.pem
    tls_key: /etc/hapee-3.3/certs/server-key.pem
    tls_ca: /etc/hapee-3.3/certs/ca-cert.pem
    ...
  2. Restart the service or Docker container:

    nix
    sudo systemctl restart hapee-extras-dataplaneapi
    nix
    sudo systemctl restart hapee-extras-dataplaneapi
    nix
    sudo docker restart <NAME OF HAPROXY ENTERPRISE CONTAINER>
    nix
    sudo docker restart <NAME OF HAPROXY ENTERPRISE CONTAINER>

Note that enabling mTLS in this way means that instead of authenticating with HAProxy Data Plane API using a username and password, you will use a client certificate and key.

You can test the HTTPS connection to HAProxy Data Plane API using curl, providing your client certificate and key. The following example is for HAProxy Data Plane API 3.0 (v3):

nix
curl -k --cert client-cert.pem --key client-key.pem --request GET https://localhost:6443/v3/info
nix
curl -k --cert client-cert.pem --key client-key.pem --request GET https://localhost:6443/v3/info
output
json
{"api":{"build_date":"2025-01-17T17:13:45.000Z","version":"v3.0.4-ee1 d354a7ec"},"system":{}}
output
json
{"api":{"build_date":"2025-01-17T17:13:45.000Z","version":"v3.0.4-ee1 d354a7ec"},"system":{}}

Do you have any suggestions on how we can improve the content of this page? Please leave feedback!