HAProxy Enterprise Documentation 2.0r1

Use fetches and converters to perform database lookups

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>*])

In this example we 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)]

In this example we 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>*])

In this example we 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

Update the database during runtime