Forum Discussion
Scott_82504
Nimbostratus
Nov 15, 2008IRules Logic and wild care at the end
I am trying to figure out a set of IRULES. They are working for the most part. Here is my issue. If the rules do not match my any of my uri (kinda like a wildcard) I want to redirect the connect...
hoolio
Cirrostratus
Nov 19, 2008Requests for extensions which are defined in the forward list should not be redirected. So the .jpg request should make it to the pool without the full filename/path being defined in the forward list.
You could add some logging to the iRule, test and then check the /var/log/ltm log file. Here is a sample of the logging you could use:
when RULE_INIT {
set ::ForwardList [list / .html .htm .asp .pl .jpg .css .jsp .gif]
}
when HTTP_REQUEST {
log local0. "[IP::client_addr]:[TCP::client_port]: New request to [HTTP::uri] (path: [HTTP::path])."
if { ([string tolower [HTTP::uri]] starts_with "/knav/nav") or
([string tolower [HTTP::uri]] starts_with "/") or
([matchclass [HTTP::path] ends_with $::ForwardList]) } {
log local0. "[IP::client_addr]:[TCP::client_port]: Matched logic to skip redirects."
return
} else {
switch -glob [string tolower [HTTP::uri]] {
"/dsc*" {
log local0. "[IP::client_addr]:[TCP::client_port]: [HTTP::path] matched /dsc*."
HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15002958"
}
"/kantech*" {
log local0. "[IP::client_addr]:[TCP::client_port]: [HTTP::path] matched /kantech*."
HTTP::redirect "http://lms2.tyco-training.com/knav/nav?BU=15002735"
}
...
}
}
}
Aaron
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
