Forum Discussion
BlurredVision_1
Nimbostratus
Mar 11, 2008HTTP Double Dipping...
All,
I know this is a crazy corner case, and that there are probably 100 ways to do this with the app, the application guys are looking for some f5 lovin to get this working as a short term workarou...
Nicolas_Menant
Employee
Mar 11, 2008Hi,
variables defined in RULE_INIT are considered global variables, which means you will have the same variable's value for ALL connections going through this iRule i.e they will share the same variable.
if you need to have a variable which is unique for a connection then it must be a local variables. local variable will be reacheable from any event.
So i would recommend to rewrite your code this way:
when RULE_INIT {
outputs useful information to logs when debug is set to 1
set ::debug 1
set ::first_lb_selected 0
set ::iteration 0
}
should become:
when RULE_INIT {
outputs useful information to logs when debug is set to 1
set ::debug 1
}
when CLIENT_ACCEPTED {
set first_lb_selected 0
set iteration 0
}
This way each connection will have its own iteration and first_lb_selected variable
I did something similar where i had to do the following:
-Send the request on poolV1
-if poolv1 response a 200 then it's a valid event then forward it to poolv2 which is the real server. If the http status is something different then do reject:
when CLIENT_ACCEPTED {
set retrying 0
}
when HTTP_REQUEST {
set uri [HTTP::uri]
set request [HTTP::request]
log local0. "HTTP request: $request"
if {[HTTP::method] eq "POST"} {
pool pool_v2
}
elseif { $retrying eq "1" } {
pool pool_v2
log local0. "sending request to [LB::server pool]"
} else {
pool pool_v1
log local0. "sending request to [LB::server pool]"
}
}
when HTTP_RESPONSE {
log local0. "HTTP_RESPONSE: status [HTTP::status]"
if { [LB::server pool] eq "poolv2" } {
log local0. "Response coming from real server ok we reinit the variable"
set retrying 0
return
} elseif { ([HTTP::status] starts_with "2") or ([HTTP::status] starts_with "3") } {
log local0. " Content ok send it to the real pool..."
set retrying 1
HTTP::retry $request
} else {
log local0. "Response denied access, we discard the connection"
reject
}
}
I face an issue with v9.4.X where some specific request make the BIGIP hang for the response. I'll keep you in touch when i'll have the response from the support (looks like it doesn't work properly with POST request)
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