HAProxy module install



The HAProxy module can be used with any operating system because it is Lua code.


Follow these steps to install the HAProxy module.

Configure the agent


This section may not be required for your installation. If you have set HAProxy's chroot directory, you will need to modify the commands below to reflect your custom chroot directory by following the instructions in this section.

If your HAProxy configuration has been modified to set a chroot directory for HAProxy, you will need to update your Next-Gen WAF agent configuration to reflect this. The default location of the agent socket file (/var/run/sigsci.sock) will be inaccessible to the HAProxy module outside of your specified chroot directory.

  1. Create the directory structure for the Unix domain socket by running the following command, replacing HAPROXY-CHROOT-DIRECTORY with your HAProxy chroot directory:

    $ sudo mkdir -p /HAPROXY-CHROOT-DIRECTORY/var/run/
  2. Add the following line to your agent configuration file (located by default at /etc/sigsci/agent.conf) to specify the new socket file location under chroot:


Module installation

Install the HAProxy module using a package manager or manually.

Install with Package Manager

The HAProxy module can be installed via the package manager of most major operating system versions:

  • Alpine: sudo apk add sigsci-module-haproxy
  • CentOS: sudo yum install sigsci-module-haproxy
  • Debian: sudo apt-get install sigsci-module-haproxy
  • Ubuntu: sudo apt-get install sigsci-module-haproxy

Install manually

Alternatively, the HAProxy module can be manually installed.

  1. Download the latest version of the HAProxy module.

    $ wget https://dl.signalsciences.net/sigsci-module-haproxy/sigsci-module-haproxy_latest.tar.gz
  2. Create the directory the HAProxy module will be moved to.

    $ sudo mkdir -p /usr/local/lib/lua/5.3/sigsci/
  3. Extract the HAProxy archive to the new directory.

    $ tar xvzf sigsci-module-haproxy_latest.tar.gz -C /usr/local/lib/lua/5.3/sigsci/

HAProxy configuration changes

After installing the HAProxy module, edit your HAProxy configuration file (located by default at /etc/haproxy/haproxy.cfg) to add the following lines:

2 ...
3 #Signal Sciences
4 lua-load /usr/local/lib/lua/5.3/sigsci/SignalSciences.lua
5 pidfile /var/run/haproxy.pid
6 ...
8frontend http-in
9 ...
10 #Signal Sciences
11 #Required for buffering request body to ensure inspection is performed
12 #Can also be set in the defaults section
13 option http-buffer-request
15 #Signal Sciences
16 http-request lua.sigsci_prerequest
17 http-response lua.sigsci_postrequest
18 ...

HAProxy 1.9+

If you are running HAProxy 1.9 or higher, in addition to the HAProxy configuration file edits above, you will also need to add the following line to the frontend http-in context:

2 # for haproxy-1.9 and above add the following:
3 http-request use-service lua.sigsci_send_block if { var(txn.sigsci_block) -m bool }
4 ...


Configuration changes are typically not required for the HAProxy module to work. However, it is possible to override the default settings if needed. To do so, you must create an override.lua file in which to add these configuration directives. Then, update the global section of your HAProxy config file (/usr/local/etc/haproxy/haproxy.cfg) to load this over-ride config file.

Example of configuration

2 ...
3 lua-load /path/to/override.lua
4 ...

Over-ride Directives

These directives may be used in your override config file.

sigsci.agenthostThe IP address or path to unix domain socket the SignalSciences Agent is listening on, default: /var/run/sigsci.sock (unix domain socket).
sigsci.agentportThe local port (when using TCP) that the agent listens on, default: nil
sigsci.timeoutAgent socket timeout (in seconds), default: 1 (0 means off).
sigsci.maxpostMaximum POST body size in bytes, default: 100000
sigsci.extra\_blocking\_resp\_hdrUser may supply a response header to be added upon 406 responses, default: ""

Example of over-ride configuration

1sigsci.agenthost = ""
2sigsci.agentport = 9090
3sigsci.extra_blocking_resp_hdr = "Access-Control-Allow-Origin: https://example.com"


To upgrade the HAProxy module, download and install the latest version of the module.

After installing, restart HAProxy for the new module version to be detected.

Was this guide helpful?

Do not use this form to send sensitive information. If you need assistance, contact support. This form is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.