Eric Wu
Eric Wu

Reputation: 45

Big-IP F5 irule get uri and store in variable

There is my irule config as below :

when HTTP_REQUEST {
switch [HTTP::query] {
    "*NetTest0*" {
         HTTP::respond 200 content "NetTest0()"
    }
    "*NetTest1*" {
         HTTP::respond 200 content "NetTest1()"
    }
    "*NetTest2*" {
         HTTP::respond 200 content "NetTest2()"
    }
    "*NetTest3*" {
         HTTP::respond 200 content "NetTest3()"
    }
}}

Is there any method can get uri as a variable, and replace NetTest0 to NetTest0()?

Upvotes: 0

Views: 1814

Answers (1)

Jason Rahm
Jason Rahm

Reputation: 710

you can use the HTTP::uri command to get and set the URI. Depending on the complexity of your replacements, you can use string map (preferred for performance reasons) or regsub (avoid if possible, but useful if you need it.)

Here are a couple examples of the string map that should help you get started:

We recently launched a new platform and engaging on DevCentral is far easier than before, feel free to join us there for future F5-related questions!

Upvotes: 0

Related Questions