HAProxy Enterprise Documentation 1.6r2


A converter is a function that always follows a fetch. It transforms the value of a fetch, for example to make a string lowercase.

In the example below, we get the HTTP request method (e.g. GET or POST) and then use the lower converter to make it lowercase. The http-request capture directive stores this data in the logs:

frontend www
   bind :80

   # The 'lower' converter changes the requested method to lowercase (e.g. GET -> get)
   http-request capture method,lower len 10

You can also chain converters one after another. In the next example, the rand fetch returns a random number between 0 and 100. We pass the result to the mul converter to multiply it by 2; Then the sub converter subtracts 5, the add converter adds 3, and the div converter divides it by 2:

frontend www
   bind :80
   http-request add-header X-Random rand(1:100),mul(2),sub(5),add(3),div(2)

Next up

Converter Reference