Learn F5 Technologies, Get Answers & Share Community Solutions Join DevCentral


Questions and Answers

Loading... Loading...

I am building an irule for a specific project and thought of doing a piece of it like this..

when HTTP_REQUEST priority 150 {
    if { $preprodpoolcheck == 1} {
         if {[class match [string tolower [HTTP::path]] contains  Domain_collapse_uri_list]} {
        set ASPserver 1
        log local0.alert "Request is for ASP server"
       } else {
           [switch -glob [string tolower [HTTP::path]] {
            "*.asp" -
            "/images/*" -
            "/extras/images/*" {set ASPserver 1}}]
           [switch -glob [string tolower [HTTP::uri]] {
            "*/default.asp" {set JSPserver 1}
            default {set JSPserver 1}}]
            }
    }
    log local0.alert "Selected Pre-Prod Servers"
}

 

Is this really possible? I would guess yes... but again i am not an expert...

I am getting this error in the logs

 Rule /Common/pre-prod : PrePROD POOL is LIVE
Jan 23 17:55:15 tmm err tmm[9493]: 01220001:3: TCL error: /Common/pre-prod - invalid command name ""     while executing "[switch -glob [string tolower [HTTP::path]] {                    "*.asp" -                "/images/*" -                    "/extras/images/*" {set ASPserver 1}}]"
 

I want to set a value to a variable depending on the URL selected.

Any ideas?


2 Answer(s):

Remove the first [ from the following;

[switch -glob [string tolower [HTTP::path]] {
[switch -glob [string tolower [HTTP::uri]] {
And the last ] from this line;

     default {set JSPserver 1}}]

Your answer:

You must be logged in to reply. You can login here.