Forum Discussion
Jo_Anglin_5148
Jan 15, 2009Historic F5 Account
uri redirect
I am a newbie to irule and would like some assistance in setting up an irule.
Currently I have a VS with a pool with 5 pool members and I am trying to set up an irule with will allow each client depending on their uri to access content on different servers.
amrvweb04 {
/7.2/*
/72Salesdemo/*
/PURV14944/*
/ops*
}
amrvweb03 {
/72Demo/*
/72dev/*
/PURV144945/*
/PURV161183/*
/PURV950053/*
/RV102535/*
/v72/*
/xRV950002/*
}
amrvweb01 {
/AUMON/*
/PURV154230/*
/RV648689/*
/RV900283DP/*
/RV910097/*
/RV950010/*
/RV950046/*
/RV950072/*
/RV950074/*
/RV950075/*
/RV950076/*
/MAINT/*
/nuTest/*
/nuTESTRS/*
/PURV144944/*
/PURV550587/*
/purv950058/*
/purv950056M/*
/RV100069/*
/RV144991/*
/RV154329/*
/RV161292/*
/RV161293/*
/rv550587/*
/rv648331/*
/rv648340/*
/rv651499/*
/rv900283/*
/RV950049/*
/rv950062/*
/rv950064/*
/RV950066/*
/RV950068/*
/RV950070/*
/RV950071/*
}
amrvweb05 {
/nosso/*
/xRV144991/*
}
amatlvsi03 {
/5.2_rv950007/*
/5._RV950048/*
/dev_5.2/*
}
when HTTP_REQUEST {
if {[matchclass [HTTP::uri] contains $::amrvweb04] } {
node 66.33.17.7
} else {
if { [matchclass [HTTP::uri] contains $::amrvweb03] } {
node 66.33.17.8
} else {
if { [matchclass [HTTP::uri] contains $::amrvweb01] } {
node 66.33.14.9
} else {
if { [matchclass [HTTP::uri] contains $::amrvweb05] } {
node 66.33.14.10
} else {
if { [matchclass [HTTP::uri] contains $::amatlvsi03] } {
node 66.33.14.11
} else {
node 66.33.14.12
}
}
}
}
}
}
Any pointers?
- JRahm
Admin
a couple things...when HTTP_REQUEST { if { [matchclass [string tolower [HTTP::uri]] contains $::consolidated_class] } { pool myPool member [findclass [string tolower [HTTP::uri]] $::consolidated_class " "] port myPort } }
- JRahm
Admin
I should also note that with this rule, you can specify the default node in an isolated pool with only member 66.33.14.12 and attach it to the virtual, that way it gets all the traffic not matched by the above rule. You could also add an else statement... - Jo_Anglin_5148Historic F5 AccountThanks for your recommendations. I will test and let you know outcome.
- Jo_Anglin_5148Historic F5 AccountSo we have a datagroup called LB_test_data_group which contains
- JRahm
Admin
myPort needs to be the tcp port of your pool member - Deb_Allen_18Historic F5 AccountMatchclass matches on the whole class entry, not just the first field, so you can't use matchclass with the suggested consolidated class. For this approach to work, you will need to have 2 classes, one for matching, another for grabbing the related pool:
class UriMatch { "nosso" "xRV144991" "5.2_rv950007" "5._RV950048" "dev_5.2" } class DestMap { "nosso 66.33.14.10" "xRV144991 66.33.14.10" "5.2_rv950007 66.33.14.11" "5._RV950048 66.33.14.11" "dev_5.2 66.33.14.11" }
[getfield [string tolower [HTTP::uri]] "/" 2]
when HTTP_REQUEST { set FirstDir [getfield [string tolower [HTTP::uri]] "/" 2] if {[matchclass $FirstDir equals $::UriMatch]}{ pool myPool member [findclass $FirstDir $::DestMap " "] } }
pool [findclass $FirstDir $::DestMap " "]
- Deb_Allen_18Historic F5 Account(hmmmm, anybody else find it exceedingly annoying that code blocks are not protected from smiley macro expansion...?)
- JRahm
Admin
Yes, definitely annoying...and thanks for picking up my scraps :-) - Jo_Anglin_5148Historic F5 AccountThanks Deb. I will have this tested and let you know the results.
- Naman_65674
Nimbostratus
Hi Deb,
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects