Forum Discussion
dubdub
Nimbostratus
Jun 15, 2011iRule to intercept traffic and then send on to original pool
Hi all,
I refuse to believe this is impossible, so I just need some advice on how to make it happen!
I am trying to create an iRule to intercept certain requests for additional pro...
dubdub
Nimbostratus
Jun 16, 2011Hi Aaron,
Thanks much for the tip on HTTP::retry, here is my latest effort:
--------
when RULE_INIT {
set static::debug 1
}
when CLIENT_ACCEPTED {
if { $static::debug != 0 } {
log local0. "setting lookup to 1"
}
set lookup 1
}
when HTTP_REQUEST {
if { [HTTP::cookie "JSESSIONID"] ne "" } {
if { $static::debug != 0 } {
log local0. "got jsession id, sending to DW"
}
pool pool_DW
} else {
if { $static::debug != 0 } {
log local0. "no session id, sending to WF for url [HTTP::host][HTTP::uri]"
}
if { [active_members pool_WF] > 0 and ($lookup == 1) } {
if { $static::debug != 0 } {
log local0. "lookup is $lookup"
log local0. "redirecting to WF, saving request first"
}
set myRequest [HTTP::request]
HTTP::uri "/DW_add_user_app"
pool pool_WF
} else {
if { $static::debug != 0 } {
log local0. "WF pool unavailable or lookup is $lookup, sending to DW"
}
pool pool_DW
}
}
}
when HTTP_RESPONSE {
if {[HTTP::header exists Content-Length] && \
([HTTP::header Content-Length] < 1048576)}{
set clength [HTTP::header Content-Length]
} else {
set clength 1048576
}
if { $static::debug != 0 } {
log local0. "collecting clength $clength"
}
HTTP::collect $clength
}
when HTTP_RESPONSE_DATA {
if { $static::debug != 0 } {
log local0. "got a reply back from web app, retrying request"
}
pool pool_DW
HTTP::retry $myRequest
set lookup 0
}
-----------
And the output:
Jun 15 20:38:25 local/tmm1 info tmm1[6449]: Rule DWIntercept : setting lookup to 1
Jun 15 20:38:25 local/tmm1 info tmm1[6449]: Rule DWIntercept : no session id, sending to WF for url dwtestvip/
Jun 15 20:38:25 local/tmm1 info tmm1[6449]: Rule DWIntercept : lookup is 1
Jun 15 20:38:25 local/tmm1 info tmm1[6449]: Rule DWIntercept : redirecting to WF, saving request first
Jun 15 20:38:25 local/tmm1 info tmm1[6449]: Rule DWIntercept : collecting clength 153
Jun 15 20:38:25 local/tmm1 info tmm1[6449]: Rule DWIntercept : got a reply back from web app, retrying request
Jun 15 20:38:25 local/tmm1 info tmm1[6449]: Rule DWIntercept : no session id, sending to WF for url dwtestvip/
Jun 15 20:38:25 local/tmm1 info tmm1[6449]: Rule DWIntercept : WF pool unavailable or lookup is 0, sending to DW
Jun 15 20:38:25 local/tmm1 info tmm1[6449]: Rule DWIntercept : collecting clength 1048576
Jun 15 20:38:25 local/tmm1 info tmm1[6449]: Rule DWIntercept : no session id, sending to WF for url dwtestvip/InfoApp
Jun 15 20:38:25 local/tmm1 info tmm1[6449]: Rule DWIntercept : WF pool unavailable or lookup is 0, sending to DW
Jun 15 20:38:25 local/tmm1 info tmm1[6449]: Rule DWIntercept : collecting clength 1048576
At this point the browser is just spinning. I'm not sure if it's waiting on collecting more data, maybe 1MB isn't enough? I tried increasing it to 10MB but I saw the documentation on HTTP::collect cautioned about stalling the connection. Hitting the root VIP normally results in a redirect to VIP/InfoApp, so there's some redirection going on at the data warehouse app as well, just to make things more interesting.
Thanks,
Jen
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