Forum Discussion

Peak_10_71174's avatar
Peak_10_71174
Icon for Nimbostratus rankNimbostratus
Feb 09, 2009

adding /* to an irule

So I need some help with the syntax of an irule. Here is what we are trying to do:

 

 

We have 2 pools, pool 1 is for the primary/static website www.abc.com and pool 2 is for backend applications such as www.abc.com/link/*. There is only 1 VIP IP associated with pool 1. My goal is to create an irule to tell the BIGIP to redirect any http requests to www.abc.com/link* to pool 2.

 

 

Here is the syntax I have so far, however the problem I've run into is that I need to find a way to put the * at the end to signify that anything past this point does not need to match and can be included in the redirect:

 

 

when HTTP_REQUEST {

 

set uri [string tolower [HTTP::uri]]

 

if { $uri ends_with "eventlogscan/" } {

 

pool App_pool

 

} elseif { $uri starts_with "/www.gfi" } {

 

pool Web_Deck_pool

 

}

 

}

 

 

Any help would be appreciated.

3 Replies

  • You might want to change this to a switch statement (Cause it's easier to look at)

     
     when HTTP_REQUEST { 
           switch -glob [string tolower [HTTP::uri]] { 
             "/www.gfi*" { pool Web_Deck_pool } 
             "*eventlogscan/" { pool App_pool } 
           } 
     } 
     

    Click here for more info on Switch statements

    Hope this helps

    CB

  • cmbhatt, thanks for the reply this has helped me as well. Lets say I want to do the exact same above except also do https requests/redirect to a " App_pool". Do I need to change the above code at all or create another iRule signifying https?
  • There are no HTTPS events to trigger off of, you have to be doing SSL offload on the LTM to be able to manipulate the HTTP events that occur after decryption. That being said, the above code or similar will work in the same manner once you've done the decryption.

     

     

    Denny