HAProxy Enterprise Documentation 1.7r2

DeviceAtlas

The DeviceAtlas module provides device detection services using the DeviceAtlas database.

Install the DeviceAtlas module

  1. Log into your account at the DeviceAtlas website and download the Enterprise API C library. Copy libda.so to your HAProxy Enterprise server into the directory /lib/x86_64-linux-gnu/.

  2. From your DeviceAtlas account, download the Device Data (JSON) file. Copy it to your HAProxy Enterprise server (e.g. /etc/hapee-1.7/deviceatlas.json).

  3. Install the DeviceAtlas module according to your platform:

    $ # On Debian/Ubuntu
    $ sudo apt-get install hapee-1.7r2-lb-da
    $ # On CentOS/RedHat/Oracle
    $ sudo yum install hapee-1.7r2-lb-da
  4. In the global section of the HAProxy Enterprise configuration file, add the following:

    global
       module-load hapee-lb-da.so
       deviceatlas-json-file /etc/hapee-1.7/deviceatlas.json
  5. Reload the HAProxy Enterprise configuration to apply the changes.

Global directives

The module adds the following global directives:

Directive

Description

deviceatlas-json-file <path> (required)

Loads a DeviceAtlas database.

deviceatlas-property-separator <separator>

Specifies the separator to use within the output. Defaults to a pipe symbol (|).

deviceatlas-log-level <level>

Sets the log level, which can be set to a number between 0 and 3 (defaults to 0):

  • 0: Fatal

  • 1: Errors

  • 2: Warnings

  • 3: Information (most verbose)

deviceatlas-properties-cookie <cookie-name>

The name of the DeviceAtlas Client-side Component cookie, if using client-side properties. Defaults to DAPROPS.

Fetches and Converters

da-csv-fetch

Use the fetch method da-csv-fetch to perform a lookup in the database that returns the values of the specified properties.

Syntax

da-csv-fetch(<prop>[,<prop>*])

Example: Create an HTTP request header that contains device information

frontend www
   bind :80
   mode http
   http-request set-header X-DeviceInfo %[da-csv-fetch(primaryHardwareType,osName,osVersion,browserName,browserVersion,browserRenderingEngine)]

Example: Define an ACL named is_mobile

frontend www
   bind :80
   mode http
   acl is_mobile da-csv-fetch(mobileDevice) 1

da-csv-conv

Use the converter da-csv-conv to perform a lookup in the database that returns the values of the specified properties. It takes the User-Agent header as an input parameter:

Syntax:

da-csv-conv(<prop>[,<prop>*])

Example: Create an HTTP request header that contains device information

frontend www
   bind :80
   mode http
   http-request set-header X-DeviceInfo %[req.hdr(user-agent),da-csv-conv(primaryHardwareType,osName,osVersion,browserName,browserVersion,browserRenderingEngine)]

Next up

WURFL InFuze