HAProxy Enterprise Documentation 1.8r2
WURFL InFuze
The WURFL module provides device detection services using the ScientiaMobile InFuze database.
Install the WURFL module
Log into your account at the ScientiaMobile website and subscribing for WURFL InFuze. Follow the installation instructions in the WURFL InFuze for C: User Guide to install the API on your HAProxy Enterprise server.
Copy the WURFL InFuze device detection database (XML file) to the HAProxy Enterprise server (e.g. /etc/hapee-1.8/wurfl.xml).
-
Install the DeviceAtlas module according to your platform:
$ # On Debian/Ubuntu
$ sudo apt-get install hapee-1.8r2-lb-wurfl
$ # On CentOS/RedHat/Oracle
$ sudo yum install hapee-1.8r2-lb-wurfl
-
Add the following to the global
section of the HAProxy Enterprise configuration file:
global
module-load hapee-lb-wurfl.so
wurfl-data-file /etc/hapee-1.8/wurfl.xml
wurfl-information-list wurfl_id model_name
wurfl-cache-size 100000
Reload the HAProxy Enterprise configuration to apply the changes.
Global directives
The global
section supports the following directives for the hapee-lb-wurfl
module:
Directive | Description |
wurfl-data-file <path>
| Required. The path to the WURFL data file. |
wurfl-information-list <value> [<value>...]
| Required. List of WURFL capabilities, virtual capabilities, and property names to use in injected HTTP headers. Separate each value with a space. See the WURFL InFuze documentation for values that you can use. |
wurfl-information-list-separator <separator>
| Separator to add between data returned from the WURFL database. Defaults to ",". |
wurfl-patch-file <path> [<path>...]
| 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. |
wurfl-cache-size <size>[,<size>]
| 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. If there is only one size value, it uses the Single LRU cache provider with the specified cache size. If there are two size values, HAProxy Enterprise uses the obsolete Double LRU cache provider. 'U' is for the User-Agent strings. 'D' is for the internal device cache. "0": Disables the cache. |
wurfl-engine-mode <mode>
| WURFL engine target (requires WURFL version < 1.9): performance (default)
accuracy
|
wurfl-useragent-priority <priority>
| Tells WURFL whether to prioritize the use of the plain user agent (plain ) over the default sideloaded browser user agent (sideloaded_browser ). |
Fetches and converters
wurfl-get
Use the fetch method wurfl-get
to perform a lookup in the database that returns the values of the specified properties. You must declare these properties beforehand with the wurfl-information-list
global directive.
Syntax
wurfl-get(<prop>[,<prop>*])
Create an HTTP request header that contains device information
frontend www
bind :80
mode http
http-request set-header X-WURFL-Properties %[wurfl-get(wurfl_id,model_name)]
wurfl-get-all
Use the fetch method wurfl-get-all
to perform a lookup in the database that returns values for all properties that the wurfl-information-list
directive declared.
Syntax
Create an HTTP request header that contains all the device properties
frontend www
bind :80
mode http
http-request set-header X-WURFL-All %[wurfl-get-all()]
Update the database during runtime
Use the WURFL Update module to keep contents of the device detection database current. This allows you to keep multiple instances of HAProxy Enterprise synced with the latest data.
Install a Web server of your choice and host the database file at a URL where HAProxy Enterprise can access. For example, host the file at http://192.168.122.1:8000/wurfl.xml.gz.
-
Install the package hapee-1.8r2-lb-wurfl-update
:
$ # On Debian/Ubuntu
$ sudo apt-get install hapee-1.8r2-lb-wurfl-update
$ # On CentOS/RedHat/Oracle
$ sudo yum install hapee-1.8r2-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://192.168.122.1:8000/wurfl.xml.gz delay 24h log
With this configuration, HAProxy Enterprise 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.
wurfl-update
The wurfl-update
directive enables updating the database over HTTP from a specified URL. Updating a database with a newer version invalidates any cached lookups (if caching is used), unless you enable checksum
and the new and old database contents are identical.
The directive supports the following syntax:
wurfl-update url <url>
[delay <u> | xdelay <u s b r>]
[timeout <t>]
[retries <n>]
[checksum | modified]
[hash]
[source <addr>[:<port>]]
[log]
[dontlog-normal]
[param*]
where:
url <url>
| Required. Specifies the database update URL. |
delay <u>
| Specifies the period between each attempt to download a new database version. The delay is a simplified version of the xdelay keyword. |
xdelay <u s b r>
| <u> specifies the period between each attempt to download a new database version
<s> specifies the initial (first) download delay
<b> specifies the delay between the download of each element of the database
If the download fails, <r> determines the delay for the next attempt Default values are: u = 5m, s = 5s, b = 10s, and r = 30s If HAProxy Enterprise cannot download the new version after three attempts, it cancels and discards the download until the next time interval defined by <u> . |
timeout <t>
| Specifies the HTTP connection timeout in milliseconds (default) for attempts to download a new database version. |
retries <n>
| Specifies the number of retries to download a new WURFL database version. If not set, the global retries value applies (defaults to 3). |
checksum
| If set, this determines the use of the SHA1 control sum to verify that the recently downloaded database is identical to the current one. If it is, then live-reload of the database does not occur, thereby preserving the cached contents (if using caching). See note below |
hash
| If set, enables authentication of the downloaded data. Each file undergoing upgrade must have the associated file with SHA1 checksum. A SHA1 checksum file has the extension .sha1. The typical way of creating a SHA1 checksum file is: sha1sum file > file.sha1 . |
modified
| Specifies the use of the time from the Last-Modified response HTTP header. Example: checks whether to update the data using the If-Modified-Since request HTTP header. See note below |
source <addr>[:<port>]
| Sets the source address for outgoing connections. <addr> is the IPv4 address HAProxy Enterprise binds to before it connects to a server
The default value is 0.0.0.0 to let the system select the most optimal address to reach its destination <port> is optional
The default value of zero means that the system selects a free port Does not support port ranges |
log
| Specifies whether to log operation errors. |
dontlog-normal
| Deactivates logging of successful updates. |
param*
| Lists other server parameters that are useful for configuring SSL features. |
Note
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 Enterprise starts.
wurfl-debug
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.
The directive supports the following syntax:
Runtime API
The following Runtime API commands are available:
wurfl-update debug [level]
| 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. |
wurfl-update mem-info [iec]
| Provides instrumentation to describe memory space usage. If the iec argument is not present, the memory size appears only as a number. If set to 1, all sizes scale to a human readable format such as 1023, 16.1K, 768M, 1.2G. This command is usable only when you compile the module in debug mode; it has no significance in normal use. |
wurfl-update show
| Shows the WURFL Update configuration. |
wurfl-update status
| Shows the module status. |
wurfl-update force-update
| Launches an update manually. |
Next up
Geolocation