For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

Austin_Geraci's avatar
Feb 05, 2010

One Vs for Redirects

This should be an easy one..

 

 

I want to use one VS for a bunch of redirects, a catch all of sorts.. If for some reason this is a bad idea just let me know.

 

 

The redirect only work for the first entry, the rest fail..

 

 

 

when HTTP_REQUEST {

 

if { [HTTP::host] eq "www.firstdomain.com" } {

 

HTTP::redirect "http://my.firstdomain.com"

 

}

 

elseif { [HTTP::host] eq "www.seconddomain.com" } {

 

HTTP::redirect "http://my.seconddomain.com"

 

}

 

}

 

 

 

 

Much appreciated

43 Replies

  •  

     

    Just a clarification, are you using one datagroup, or a datagroup for every redirect?

     

  • I use a unique data group per host portion of your URL.

    You can multiple URI inside of each data group.

    I did it this way as the potential of error is reduced.

    In my case, I have hundreds of vanity URL's as we call them.

    http://something.test.com -> https://sharepoint.test.com?=blah.blah.blah

     
     class VURL_something.test.com { 
        "/ https://sharepoint.test.com?=blah.blah.blah" 
     } 
     

    or this works as well

    http://something.test.com -> https://sharepoint.test.com?=blah.blah.blah

    http://something.test.com/stats -> https://stats.test.com

    http://something.test.com/devcentral -> https://devcentral.f5.com

     
     class VURL_something.test.com { 
         "/ https://sharepoint.test.com?=blah.blah.blah" 
         "/stats https://stats.test.com" 
         "/devcentral https://devcentral.f5.com" 
     } 
     

    --j

  • Gotcha that's what I thought from your show of multiple classes...

     

     

    This method can definitely prove to be cleaner if you have coworkers who are using the gui opposed to cli....

     

     

    Then you can just manage it from a datagroup(class) instead of editing a datagroup, which fine through the cli, but if you use the gui, I can quickly see how that can become messy and confusing, as there seems to be no rhyme or reason how the cli organizes datagroups......

     

     

    That's been a qualm of my in general for a while with the gui... and please if someone has some info on this shed some light... it seems the gui organizes/inputs entries arbitrarily...

     

     

    for instance when listing monitors from the gui, or when the gui inputs VS/Pool/monitors etc etc into the bigip.conf file... what is the logic?? Would it really been that hard to organize things alphabetically? or use some sort of other ordering logic?