iRules script stepper
Run a short iRule snippet one command at a time and see what each command received after substitution, what it returned and which variables changed. The quickest way to understand quotes, braces, append, concat, incr and the branch if or switch took. Local, no network.
NetværkTry
Sample request (what the iRules commands return)
These are the answers the iRules commands give in this tool. Nothing is sent anywhere: pool, HTTP::redirect and similar actions are recorded, not performed.
Finished. Last result: ∅
4 commands, in the order they started
An indented command ran inside the one above it: in its body, or in brackets while its words were being built (so it finished first).
- 1line 1
set uri [HTTP::uri]receivedseturi/login.php?user=abcreturned/login.php?user=abcuri: unset →/login.php?user=abc
- 2line 1
HTTP::urireceivedHTTP::urireturned/login.php?user=abc - 3line 2
if { $uri starts_with "/login" } { …receivedif$uri starts_with "/login"↵ log local0. "login: $uri"↵elseif$uri starts_with "/api"↵ pool api_pool↵else↵ pool web_pool↵returned∅- A condition was true, so the body after it runs and the rest are skipped.
Expression evaluated:
$uri starts_with "/login"$uri starts_with "/login"1integerstarts_withis one of the operators F5 adds to iRules. It compares the values as text.
$uri/login.php?user=abc- Reads the variable
uri.
- Reads the variable
"/login"/login- Text in double quotes, with nothing inside to substitute.
- 4line 2
log local0. "login: $uri"receivedloglocal0.login: /login.php?user=abcreturned∅
Variables at the end
$uri/login.php?user=abc
Logged and recorded
log local0.login: /login.php?user=abc
Referencer
- F5 K6091: The version of Tcl used to develop iRules
- Tcl 8.4 manual: Tcl (the substitution rules)
- Tcl 8.4 manual: append
- Tcl 8.4 manual: concat
- Tcl 8.4 manual: lappend
- Tcl 8.4 manual: incr
- Tcl 8.4 manual: switch
- F5 K57410758: warning [use curly braces to avoid double substitution]
- F5 K36322151: List of disabled Tcl commands for iRules (12.x - 17.x)
- F5 iRules reference: log
- F5 iRules reference: HTTP::uri
- F5 iRules reference: HTTP::host
- Tcl 8.4.6 source code, tag core-8-4-6 on GitHub