Forum Discussion

Allim_63326's avatar
Allim_63326
Icon for Nimbostratus rankNimbostratus
Aug 04, 2009

CSS to F5 url redirect

We are migrating from CSS to F5s v10.0.0.

 

The CSS has two VIPs same IP and port one is a default url "/a*" and other url is "/connected window*" that goes to same server

 

 

I was reading the forum and found that I need to creat iRule for this, let me know if this is the correct translation.

 

 

when HTTP_REQUEST {

 

if { [string tolower [HTTP::uri]] contains "connectedwindow"} {

 

pool connect_pool

 

}

 

}

 

 

is there a better way to write this or will this even work?

 

 

here is sample from CSS:

 

 

content beta.pa

 

vip address 1.1.1.1

 

add service ABCserver

 

protocol tcp

 

port 80

 

url "/a*"

 

active

 

content beta_conn.pa

 

vip address 1.1.1.1

 

add service ABCserver

 

protocol tcp

 

port 80

 

url "/connectedwindow*"

 

active

 

 

 

Thanks in advance.

2 Replies

  • /a* with string matching equates to

    [HTTP::uri] starts_with "/a"

    You could also use:

    [string match "/a*" [HTTP::uri]]

    Similarly, /connectedwindow* equates to:

    [HTTP::uri] starts_with "/connectedwindow"

    or:

    [string match "/connectedwindow*" [HTTP::uri]]

    You could also use a switch statement with glob style wildcard matching:

     
     when HTTP_REQUEST { 
      
         Check requested URI 
        switch -glob [HTTP::uri] { 
      
           "/a*" { 
              pool a_pool 
           } 
           "/connectedwindow*" { 
              pool connect_pool 
           } 
           default { 
               Take some default action? 
           } 
        } 
     } 
     

    Aaron
  • Thanks Aaron for the quick reply, I will use glob style wildcard matching, we don't have any default action. Can I just use like you recommended.

     

     

    I will do the test and let you know.

     

     

    Thanks again