This module provides 51Degrees device intelligence support and allows automatic updates of its database during runtime.

Install the 51Degrees module

  1. Get the 51Degrees database in Trie format.


    If you are using the free lite database, you must register here to download the database in Trie format (still free), because the pattern format on Github does not work.


    If you are already an 51Degrees customer, you can log in at the 51Degrees website and download the enterprise database in Trie format (if you choose to subscribe, please say that HAProxy Technologies referred you.)

  2. Install the 51Degrees module: apt install hapee-1.5r2-lb-51d (or yum install depending on your platform of choice).

  3. In the global section of your configuration, add the following lines:

    module-path        /opt/hapee-1.5r2/modules/
    51degrees-data-file /etc/hapee-1.5r2/51Degrees-LiteV3.4.trie
    51degrees-property-name-list DeviceType IsMobile IsTablet


    The 51degrees-property-name-list can change depending on the properties you want to use.

  4. Add fetches such as to your frontend to make use of the data:

    http-request set-header X-51D-DeviceTypeMobileTablet %[req.fhdr(User-Agent),51d.single(DeviceType,IsMobile,IsTablet)]

Update the database during runtime

  1. Install the package hapee-1.5r2-lb-51d-update.

  2. Add the following lines to the global section of your configuration:

    51degrees-update url delay 24h log

With this configuration, HAProxy downloads the database every 24 hours, and prints a message in the logs when it succeeds or if it encountered errors during the update.