You are right Tim, No this is not a bug. In fact you can use log format variables in actions also. After looking to the code and docs, I think you can use log format variables whenever you have <fmt> in the docs, ex: add-header <name> <fmt> set-query <fmt> etc
It seems that historically log format variables where used for logging then the usage was expended to actions. To sum up: - When you find "log format expression" in the docs: then you can use log variables %ci which also the log format has access to sample expressions via square brackets: %[src] or %[src,ipmask(24)] - When you find "sample expression" in the docs: then you can use only sample fetches and converters. On 30/01/2018 14:04, Tim Düsterhus wrote: > Moemen, > > Am 30.01.2018 um 10:15 schrieb Moemen MHEDHBI: >> The variables you are talking about are more precisely "log format >> variables" that are only available for the logging part of HAProxy. > Yes, they are documented in the "log format" section, but they seem to > work in other places as well. That's why I asked: > > haproxy.cfg: >> defaults >> timeout connect 5s >> timeout client 50s >> timeout server 50s >> >> frontend https >> mode http >> bind :8080 >> >> http-response set-header Test %ci >> http-response set-header Test2 %[src] >> >> use_backend example >> >> backend example >> mode http >> server example example.com:80 > Example curl: > >> [timwolla@~]curl -I localhost:8080 >> HTTP/1.1 404 Not Found >> Content-Type: text/html >> Date: Tue, 30 Jan 2018 13:02:30 GMT >> Server: ECS (lga/1395) >> Content-Length: 345 >> Test: 127.0.0.1 >> Test2: 127.0.0.1 > Is it a bug that they work inside for example http-response set-header > (as shown above) as well? > > Best regards > Tim Düsterhus -- Moemen MHEDHBI

