Forum Discussion
Roman_80473
Nimbostratus
Nov 29, 2011Redirect to another URL from inside HTTP::REQUEST after timeout detected
Hi guys,
I have setup the timer using the 'after' command inside HTTP_REQUEST which I then cancel in HTTP_RESPONSE. I detect timeout and take node out of the mix. I then need to redirect req...
This looks like a bug. For the following test, I'd expect three empty results followed by the actual value of the aaa parameter. Instead, all the "a, aa, aaa" parameter names return the value of the aaa parameter:
Tested on
when RULE_INIT {
set uri "/path/to/file.ext?aaa=111"
log local0. "\$uri: $uri"
log local0. "\[URI::query \$uri b\]: [URI::query $uri b]"
log local0. "\[URI::query \$uri a\]: [URI::query $uri a]"
log local0. "\[URI::query \$uri aa\]: [URI::query $uri aa]"
log local0. "\[URI::query \$uri aaa\]: [URI::query $uri aaa]"
}
: $uri: /path/to/file.ext?aaa=111
: [URI::query $uri b]:
: [URI::query $uri a]: 111 <--- ?? this should be null
: [URI::query $uri aa]: 111 <--- ?? this should be null
: [URI::query $uri aaa]: 111
I'd suggest opening a case with F5 Support. In the meantime, you could manually parse the query string in a loop or using a regex:
Loop through each parameter name looking for "param2" and log the name and value
set namevals [split [HTTP::query] "&"]
for {set i 0} {$i < [llength $namevals]} {incr i} {
set params [split [lindex $namevals $i] "="]
if {[lindex $params 0] eq "param2"}{
log local0. "Param: [lindex $params 0], Value: [lindex $params 1]"
}
}
In most regex flavors, you could use a lookbehind to match anything after the parameter name (param2 in this example):
(?<=(?:&|\?)param2=)[^&]*
Intead, you could use a combination of commands to get the parameter value (replace param2 with the actual parameter name):
Parse the value for the first "param2" parameter instance in the query string
set param_value [getfield [regexp -inline {(?:&|\?)param2=[^&]*} "?[HTTP::query]"] "=" 2]
I'm not sure which option would be more efficient. But I'd guess the loop might be more efficient for small numbers of parameters in the query string.
Aaron
- Derek_Murphy_38Aug 21, 2012
Nimbostratus
I found what I'm looking for: https://devcentral.f5.com/wiki/iControl.LocalLB__Pool__get_member_session_status.ashx - Darrell_G_36120Aug 21, 2012
Altocumulus
I haven't checked the code to disable the member from the pool, but do have a snippet where i disable the node itself (after I add it).Create node if it doesn't already exist. unless bigip['LocalLB.NodeAddressV2'].get_list.include? '/Common/' + node_name bigip['LocalLB.NodeAddressV2'].create([ node_name ], [ node_address ], [0]) puts ' Created node "' + node_name + '" with IP Address "' + node_address + '"...' After we add a member... let's disable the node state bigip['LocalLB.NodeAddressV2'].set_session_enabled_state([ node_name ], [ "STATE_DISABLED" ]) puts ' Node "' + node_name + '"set to disabled..."' else puts ' Node "' + node_name + '" already exists! Not Added.' end
- Derek_Murphy_38Aug 21, 2012
Nimbostratus
Darrell, - Darrell_G_36120Aug 21, 2012
Altocumulus
Here's a snippet of my updated f5-node-initiator (this was the one good example of pool/node manipulation using the Ruby iControl).