Searching HAProxy Enterprise 1.9r1
Detecting Devices using WURFL InFuze
HAProxy Enterprise's WURFL module uses the InFuze technology from ScientiaMobile to provide device detection services. This feature can also apply live updates of databases, similar to HAProxy's Update module for maps/ACLs.
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.
Prerequisites
HAProxy Enterprise version 1.7r1 or newer
The WURFL Update module requires HAProxy Enterprise version 1.9r1 or newer
The HAProxy WURLFL module requires the WURFL InFuze C API to run. You must obtain the WURFL InFuze C API (libwurfl) from ScientiaMobile by registering for an account and subscribing for WURFL InFuze. Follow the installation instructions in the WURFL InFuze for C: User Guide to install the API on the HAProxy server.
A copy of the WURFL InFuze device detection database (XML file).
Install the HAProxy WURFL module
Copy the WURFL InFuze device detection database to the HAProxy server.
-
Install the HAProxy WURFL module using
apt
oryum
depending on your operating system:$ sudo apt install hapee-1.9r1-lb-wurfl
Configure the WURFL module
-
Add the following to the
global
section of the HAProxy configuration file:global module-load hapee-lb-wurfl.so wurfl-data-file /path/to/wurfl.xml wurfl-information-list wurfl_id model_name wurfl-cache-size 100000
Update the database during runtime
HAProxy can download periodically a new version of the XML database during runtime by using the WURFL Update module. This is especially useful when you are running more than one HAProxy instance.
Install a Web server of your choice and host the WURFL XML database file at a URL where HAProxy can access. For example, host the file at http://localhost:8000/wurfl.xml.gz.
-
Install the HAProxy WURFL Update module using
apt
oryum
:$ sudo apt install hapee-1.9r1-lb-wurfl-update
-
In the
global
section of your configuration, add directives similar to the following example:global module-load hapee-lb-wurfl-update.so wurfl-update url http://localhost:8000/wurfl.xml.gz delay 24h log
With this configuration, HAProxy downloads the database every 24 hours and displays a message in the logs when it succeeds, or when it encounters an error during the update.
Global parameters
The global
section supports the following directives for the hapee-lb-wurfl
module:
Directive | Description |
---|---|
| The path to the WURFL data file. |
| List of WURFL capabilities, virtual capabilities, and property names to use in injected HTTP headers. You must separate each value with a space. See the WURFL InFuze documentation for values that you can use with HAProxy. |
| Separator to add between data returned from the WURFL database. Defaults to ",". |
| Lists the file paths to WURFL patch definitions. You can have as many as necessary, and the API applies them in the order they appear in the configuration file. Separate each value with a space. |
| The LRU cache speeds up lookup operations on User-Agent strings that were previously processed. This directive sets the number of entries to keep in the cache.
|
| WURFL engine target (requires WURFL version < 1.9):
|
| Tells WURFL whether to prioritize the use of the plain user agent ( |
The global
section supports the following directives for the hapee-lb-wurfl-update
module:
Directive | Description |
---|---|
| Sets the debug level. The default is 7. Use this only when the module runs in debug mode; in normal use, it has no significance. |
| Enables database update over HTTP from specified URL. Updating the database with a newer version invalidates any cached lookups (if using caching), unless you enable |
where:
| Specifies the database update URL. |
| Specifies the period between each attempt to download a new database version. The delay is a simplified version of the |
|
|
| Specifies the HTTP connection timeout in milliseconds (default) for attempts to download a new database version.
|
| Specifies the number of retries to download a new WURFL database version. If not set, the global |
| If set, this determines the use of the |
| If set, enables authentication of the downloaded data.
|
| Specifies the use of the time from the |
| Sets the source address for outgoing connections.
|
| Specifies whether to log operation errors. |
| Deactivates logging of successful updates. |
| Lists other server parameters that are useful for configuring SSL features. |
Note
When you set parameters for wurfl-update
, the options checksum
and modified
are mutually exclusive. If you define them at the same time, the option modified
automatically switches off and a warning message prints when HAProxy starts.
Fetches
HAProxy uses fetches to perform a lookup in the database and return the values of the specified properties.
The
wurfl-get
fetch returns the specified properties, which you must declare beforehand with thewurfl-information-list
directive. - Thewurfl-get-all
fetch returns all properties that thewurfl-information-list
directive declared.
Syntax:
wurfl-get-all()
wurfl-get(propertyA,propertyB,...)
Example:
# Used in the a frontend, listen, or backend section
# Get all data listed in wurfl-information-list
# Sets a header: 'X-Wurfl-All: firefox_69_0,Firefox'
http-request set-header X-WURFL-All %[wurfl-get-all()]
# Get a subset of data listed in wurfl-information-list
# Sets a header: 'X-Wurfl-Properties: firefox_69_0,Firefox'
http-request set-header X-WURFL-Properties %[wurfl-get(wurfl_id,model_name)]
HAProxy Runtime API
The following HAProxy Runtime API commands are available:
| Sets the debug level (default: 7). This command is usable only when you compile the module in debug mode; it has no significance in normal use. |
| Provides instrumentation to describe memory space usage. If the |
| Shows the WURFL Update configuration. |
| Shows the module status. |
| Launches an update manually. |