- replace-value <name> <regex-match> <replace-fmt>
- set-header <name> <fmt>
- set-status <status> [reason <str>]
- - set-var(<var-name>) <expr>
- - set-var-fmt(<var-name>) <fmt>
+ - set-var(<var-name>[,<cond> ...]) <expr>
+ - set-var-fmt(<var-name>[,<cond> ...]) <fmt>
- strict-mode { on | off }
- unset-var(<var-name>)
between 100 and 999. Please refer to "http-response set-status" for a complete
description.
-http-after-response set-var(<var-name>) <expr> [ { if | unless } <condition> ]
-http-after-response set-var-fmt(<var-name>) <fmt> [ { if | unless } <condition> ]
+http-after-response set-var(<var-name>[,<cond> ...]) <expr> [ { if | unless } <condition> ]
+http-after-response set-var-fmt(<var-name>[,<cond> ...]) <fmt> [ { if | unless } <condition> ]
This is used to set the contents of a variable. The variable is declared
inline. Please refer to "http-request set-var" and "http-request set-var-fmt"
"http-check send".
-http-check set-var(<var-name>) <expr>
-http-check set-var-fmt(<var-name>) <fmt>
+http-check set-var(<var-name>[,<cond> ...]) <expr>
+http-check set-var-fmt(<var-name>[,<cond> ...]) <fmt>
This operation sets the content of a variable. The variable is declared inline.
May be used in sections: defaults | frontend | listen | backend
yes | no | yes | yes
The name may only contain characters 'a-z', 'A-Z', '0-9', '.',
and '-'.
+ <cond> A set of conditions that must all be true for the variable to
+ actually be set (such as "ifnotempty", "ifgt" ...). See the
+ set-var converter's decription for a full list of possible
+ conditions.
+
<expr> Is a sample-fetch expression potentially followed by converters.
<fmt> This is the value expressed using log-format rules (see Custom
- set-timeout { server | tunnel } { <timeout> | <expr> }
- set-tos <tos>
- set-uri <fmt>
- - set-var(<var-name>) <expr>
- - set-var-fmt(<var-name>) <fmt>
+ - set-var(<var-name>[,<cond> ...]) <expr>
+ - set-var-fmt(<var-name>[,<cond> ...]) <fmt>
- send-spoe-group <engine-name> <group-name>
- silent-drop
- strict-mode { on | off }
path and the query string.
See also "http-request set-path" and "http-request set-query".
-http-request set-var(<var-name>) <expr> [ { if | unless } <condition> ]
-http-request set-var-fmt(<var-name>) <fmt> [ { if | unless } <condition> ]
+http-request set-var(<var-name>[,<cond> ...]) <expr> [ { if | unless } <condition> ]
+http-request set-var-fmt(<var-name>[,<cond> ...]) <fmt> [ { if | unless } <condition> ]
This is used to set the contents of a variable. The variable is declared
inline.
The name may only contain characters 'a-z', 'A-Z', '0-9'
and '_'.
+ <cond> A set of conditions that must all be true for the variable to
+ actually be set (such as "ifnotempty", "ifgt" ...). See the
+ set-var converter's decription for a full list of possible
+ conditions.
+
<expr> Is a standard HAProxy expression formed by a sample-fetch
followed by some converters.
- set-nice <nice>
- set-status <status> [reason <str>]
- set-tos <tos>
- - set-var(<var-name>) <expr>
- - set-var-fmt(<var-name>) <fmt>
+ - set-var(<var-name>[,<cond> ...]) <expr>
+ - set-var-fmt(<var-name>[,<cond> ...]) <fmt>
- silent-drop
- strict-mode { on | off }
- track-sc0 <key> [table <table>]
to the value passed in <tos> on platforms which support this. Please refer to
"http-request set-tos" for a complete description.
-http-response set-var(<var-name>) <expr> [ { if | unless } <condition> ]
-http-response set-var-fmt(<var-name>) <fmt> [ { if | unless } <condition> ]
+http-response set-var(<var-name>[,<cond> ...]) <expr> [ { if | unless } <condition> ]
+http-response set-var-fmt(<var-name>[,<cond> ...]) <fmt> [ { if | unless } <condition> ]
This is used to set the contents of a variable. The variable is declared
inline. Please refer to "http-request set-var" and "http-request set-var-fmt"
"tcp-check send", tune.bufsize
-tcp-check set-var(<var-name>) <expr>
-tcp-check set-var-fmt(<var-name>) <fmt>
+tcp-check set-var(<var-name>[,<cond> ...]) <expr>
+tcp-check set-var-fmt(<var-name>[,<cond> ...]) <fmt>
This operation sets the content of a variable. The variable is declared inline.
May be used in sections: defaults | frontend | listen | backend
yes | no | yes | yes
The name may only contain characters 'a-z', 'A-Z', '0-9', '.',
and '-'.
+ <cond> A set of conditions that must all be true for the variable to
+ actually be set (such as "ifnotempty", "ifgt" ...). See the
+ set-var converter's decription for a full list of possible
+ conditions.
+
<expr> Is a sample-fetch expression potentially followed by converters.
<fmt> This is the value expressed using log-format rules (see Custom
- set-src <expr>
- set-src-port <expr>
- set-tos <tos>
- - set-var(<var-name>) <expr>
- - set-var-fmt(<var-name>) <fmt>
+ - set-var(<var-name>[,<cond> ...]) <expr>
+ - set-var-fmt(<var-name>[,<cond> ...]) <fmt>
- silent-drop
- track-sc0 <key> [table <table>]
- track-sc1 <key> [table <table>]
to the value passed in <tos> on platforms which support this. Please refer to
"http-request set-tos" for a complete description.
-tcp-request connection set-var(<var-name>) <expr> [ { if | unless } <condition> ]
-tcp-request connection set-var-fmt(<var-name>) <fmt> [ { if | unless } <condition> ]
+tcp-request connection set-var(<var-name>[,<cond> ...]) <expr> [ { if | unless } <condition> ]
+tcp-request connection set-var-fmt(<var-name>[,<cond> ...]) <fmt> [ { if | unless } <condition> ]
This is used to set the contents of a variable. The variable is declared
inline. "tcp-request connection" can set variables in the "proc" and "sess"
- set-src <expr>
- set-src-port <expr>
- set-tos <tos>
- - set-var(<var-name>) <expr>
- - set-var-fmt(<var-name>) <fmt>
+ - set-var(<var-name>[,<cond> ...]) <expr>
+ - set-var-fmt(<var-name>[,<cond> ...]) <fmt>
- silent-drop
- switch-mode http [ proto <name> ]
- track-sc0 <key> [table <table>]
to the value passed in <tos> on platforms which support this. Please refer to
"http-request set-tos" for a complete description.
-tcp-request content set-var(<var-name>) <expr> [ { if | unless } <condition> ]
-tcp-request content set-var-fmt(<var-name>) <fmt> [ { if | unless } <condition> ]
+tcp-request content set-var(<var-name>[,<cond> ...]) <expr> [ { if | unless } <condition> ]
+tcp-request content set-var-fmt(<var-name>[,<cond> ...]) <fmt> [ { if | unless } <condition> ]
This is used to set the contents of a variable. The variable is declared
inline. Please refer to "http-request set-var" and "http-request set-var-fmt"
- set-src <expr>
- set-src-port <expr>
- set-tos <tos>
- - set-var(<var-name>) <expr>
- - set-var-fmt(<var-name>) <fmt>
+ - set-var(<var-name>[,<cond> ...]) <expr>
+ - set-var-fmt(<var-name>[,<cond> ...]) <fmt>
- silent-drop
- track-sc0 <key> [table <table>]
- track-sc1 <key> [table <table>]
to the value passed in <tos> on platforms which support this. Please refer to
"http-request set-tos" for a complete description.
-tcp-request session set-var(<var-name>) <expr> [ { if | unless } <condition> ]
-tcp-request session set-var-fmt(<var-name>) <fmt> [ { if | unless } <condition> ]
+tcp-request session set-var(<var-name>[,<cond> ...]) <expr> [ { if | unless } <condition> ]
+tcp-request session set-var-fmt(<var-name>[,<cond> ...]) <fmt> [ { if | unless } <condition> ]
This is used to set the contents of a variable. The variable is declared
inline. Please refer to "http-request set-var" and "http-request set-var-fmt"
- set-mark <mark>
- set-nice <nice>
- set-tos <tos>
- - set-var(<var-name>) <expr>
- - set-var-fmt(<var-name>) <fmt>
+ - set-var(<var-name>[,<cond> ...]) <expr>
+ - set-var-fmt(<var-name>[,<cond> ...]) <fmt>
- silent-drop
- unset-var(<var-name>)
to the value passed in <tos> on platforms which support this. Please refer to
"http-request set-tos" for a complete description.
-tcp-response content set-var(<var-name>) <expr> [ { if | unless } <condition> ]
-tcp-response content set-var-fmt(<var-name>) <fmt> [ { if | unless } <condition> ]
+tcp-response content set-var(<var-name>[,<cond> ...]) <expr> [ { if | unless } <condition> ]
+tcp-response content set-var-fmt(<var-name>[,<cond> ...]) <fmt> [ { if | unless } <condition> ]
This is used to set the contents of a variable. The variable is declared
inline. Please refer to "http-request set-var" and "http-request set-var-fmt"
# value, without leaking the contents using a timing attack.
acl token_given str(my_secret_token),secure_memcmp(txn.token)
-set-var(<var>)
+set-var(<var>[,<cond> ...])
Sets a variable with the input content and returns the content on the output
- as-is. The variable keeps the value and the associated input type. The name of
- the variable starts with an indication about its scope. The scopes allowed are:
+ as-is if all of the specified conditions are true (see below for a list of
+ possible conditions). The variable keeps the value and the associated input
+ type. The name of the variable starts with an indication about its scope. The
+ scopes allowed are:
"proc" : the variable is shared with the whole process
"sess" : the variable is shared with the whole session
"txn" : the variable is shared with the transaction (request and
This prefix is followed by a name. The separator is a '.'. The name may only
contain characters 'a-z', 'A-Z', '0-9', '.' and '_'.
+ You can pass at most four conditions to the converter among the following
+ possible conditions :
+ - "ifexists"/"ifnotexists":
+ Checks if the variable already existed before the current set-var call.
+ A variable is usually created through a successful set-var call.
+ Note that variables of scope "proc" are created during configuration
+ parsing so the "ifexists" condition will always be true for them.
+ - "ifempty"/"ifnotempty":
+ Checks if the input is empty or not.
+ Scalar types are never empty so the ifempty condition will be false for
+ them regardless of the input's contents (integers, booleans, IPs ...).
+ - "ifset"/"ifnotset":
+ Checks if the variable was previously set or not, or if unset-var was
+ called on the variable.
+ A variable that does not exist yet is considered as not set. A "proc"
+ variable can exist while not being set since they are created during
+ configuration parsing.
+ - "ifgt"/"iflt":
+ Checks if the content of the variable is "greater than" or "less than"
+ the input. This check can only be performed if both the input and
+ the variable are of type integer. Otherwise, the check is considered as
+ true by default.
+
sha1
Converts a binary input sample to a SHA-1 digest. The result is a binary
sample with length of 20 bytes.