Use fetches and converters to perform database lookups
51d.all
Use the fetch method 51d.all
to perform a lookup in the database that returns the values of the specified properties. The function can be passed up to five property names and if a property name can't be found, the value NoData
is returned.
Syntax
51d.all(<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 %[51d.all(DeviceType,IsMobile,IsTablet)]
In this example, we define an ACL named is_mobile
.
frontend www
bind :80
mode http
acl is_mobile 51d.all(IsMobile) "True"
51d.single
Use the converter 51d.single
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. The function can be passed up to five property names and if a property name can't be found, the value NoData
is returned.
Syntax:
51d.single(<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),51d.single(DeviceType,IsMobile,IsTablet)]
Next up
Update the database during runtime