Searching HAProxy Enterprise 1.9r1
Detecting Devices with 51Degrees
HAProxy Enterprise offers a module that provides 51Degrees' device detection services.
Tip
- HAProxy Enterprise only: This module requires an active HAProxy
-
Enterprise subscription. Please contact us if you would like to learn more or begin a free trial.
Install the 51Degrees module
-
Get the 51Degrees database in Trie format.
Note
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.
Note
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.)
Install the 51Degrees module:
apt install hapee-1.9r1-lb-51d
(oryum install
depending on your platform of choice).-
In the global section of your configuration, add the following lines:
global module-path /opt/hapee-1.9r1/modules/ module-load hapee-lb-51d.so 51degrees-data-file /etc/hapee-1.9r1/51Degrees-LiteV3.4.trie 51degrees-property-name-list DeviceType IsMobile IsTablet
Note
The
51degrees-property-name-list
can change depending on the properties you want to use. -
Add fetches such as
51d.singles
to your frontend to make use of the data:frontend <name> http-request set-header X-51D-DeviceTypeMobileTablet %[req.fhdr(User-Agent),51d.single(DeviceType,IsMobile,IsTablet)]
Update the database during runtime
Install the package
hapee-1.9r1-lb-51d-update
.-
Add the following lines to the global section of your configuration:
global module-load hapee-lb-51d-update.so 51degrees-update url http://192.168.122.1/51Degrees-LiteV3.4.trie 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.