Forum Discussion
Mojdeh_Koushki_
Nimbostratus
Oct 14, 2005iRule Script in Ver 9 is not functioning
hello
here is my problem, i have a set of bigip for bunch of web farm on ver 4.5.10, which i have this iRule for it and it is functioning Very Well...
if (getfield(http_uri, '/', 2) matches_regex "[Ww][Ee][Bb][Aa][Pp][Pp]") {
redirect to "https://%h/%u"
}
else {
use pool WebApp-50
}
and now we are upgrading to version 9 and compatable iRule for version 9 is COMPILING but NOT FUNCTIONING ...
here is the script...
when HTTP_REQUEST {
if { [string tolower [getfield [HTTP::uri] '/' 2]] == "webapp" } {
HTTP::redirect "https://[HTTP::host][HTTP::uri]"
} else {
pool POOL_HTTP_Vlan70
}
}
could you please tell me WHY?
thanks alot
Mojdeh
51 Replies
Sort By
- drteeth_127330Historic F5 AccountIt's fairly obvious from the above log, but getfield doesn't behave in what I would call an intuitive manner. Since the URI path begins with a slash, the first path component is really field 2. So, using getfield on a URI is /two/three/four/five. The first field is always empty. Is that what you were expecting?
- As you can see from the trace, Field2 which comes from the getfield command with the slash in double quotes is getting set correctly.Oct 14 14:23:07 tmm tmm[648]: Rule redirect2 : URI: /webnav/navapp1.asp?association_link=lncust1_hunt&brand_cd=huntxx00
when HTTP_REQUEST { if { [string tolower [HTTP::uri]] starts_with "/webnav" } { HTTP::redirect "https://[HTTP::host][HTTP::uri] } else { pool POOL_HTTP_Vlan70 } }
- Either use an elseif
when HTTP_REQUEST { set uri [string tolower [HTTP::uri]] if { $uri starts_with "/webnav" } { HTTP::redirect "https://[HTTP::host][HTTP::uri] } elseif { $uri starts_with "/webapp" } { HTTP::redirect "https://[HTTP::host][HTTP::uri] } else { pool POOL_HTTP_Vlan70 } }
when HTTP_REQUEST { set uri [string tolower [HTTP::uri]] if { ($uri starts_with "/webnav") or ($uri starts_with "/webapp") } { HTTP::redirect "https://[HTTP::host][HTTP::uri] } else { pool POOL_HTTP_Vlan70 } }
- Just make sure you comment out (using "") the log statements once you've got all the kinks worked out. No need for that extra overhead if you don't need it.
- Mojdeh_Koushki_
Nimbostratus
Joe - Colin_Walker_12Historic F5 Accountkoushki,
- Mojdeh_Koushki_
Nimbostratus
well original problem was .... it was not working when we apply iRule ... so originally iRule did not working so Joe's adding line it was just for debug - Mojdeh_Koushki_
Nimbostratus
i have to ask my original question again : - Colin_Walker_12Historic F5 AccountThe code for the rule that you're asking about has been well documented in this thread. Joe provided you a solution, and you confirmed that this solution was working for you.
- Mojdeh_Koushki_
Nimbostratus
yes ... i did, i create the new rule.
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