HAProxy Enterprise Documentation 1.9r1

Syntax

All variables are scoped, meaning they can only be accessed within the same or larger scope. When you set a variable, you prefix its names with a scope. The scope can be any of the following:

  • proc: variable is available during all phases

  • sess: variable is available during a client's entire TCP session

  • txn: variable is available during an entire HTTP request-response transaction

  • req: variable is available during the HTTP request phase only

  • res: variable is available during the HTTP response phase only

Use the set-var directives to set a variable:

  • http-request set-var

  • http-response set-var

  • http-response-after-response set-var

In the following example, the variable mypath is scoped to the transaction, which makes it available during both the request and response phases:

frontend www
   bind :80
   http-request set-var(txn.mypath) path

Unset a variable

Use one of the following directives to unset a variable:

  • http-request unset-var

  • http-response unset-var

  • http-response-after-response unset-var


Next up

Environment Variables