Is it possible to use the following Irule syntac with TCL in a policy ?
Hello, I've setup some code in an Irule . This concerns a code that will take the URI, within this uri, search for first directory in the path and put it tolower before sending it to the server. set uri [HTTP::uri] set block [lindex [split $uri /] 1] if { $block ne [string tolower $block]} { set block2 [string tolower $block] HTTP::uri [string map [list $block $block2] $uri] #log local0. "Rewrited part of the URI : $block2" #log local0. "URI Send to Back-end application : https://[HTTP::host][HTTP::uri]" } Is it possible to put this code in a TCL within a policy rule ? I need to replace the first directory of the URI (ie: "/APPLICATION/dir1/DIR2/index.html") to lowercase /application/dir1/DIR2/index.html ( the rest of the URI must stay intact, only /Application/ part must be set to lowercase. Thanks in advance. Regards Frédéric535Views1like2Commentsstring trim generating strange results
Hi, I have an issue with one of my string manipulations with variables: set test [ACCESS::session data get session.http.last.response_cookie] set test [lindex [split $test "|"] 0] set test [string trim $test "Test="] So, my cookie is built up like this: example: Test=ZTR(abc1234-1);ABC(qwe12314);|version=1;... example: Test=OEZZV(abc1234);ABC(qwe12314);|version=1... In the first example, my $test ends up being correctly shown as "ZTR(abc1234-1);ABC(qwe12314);". In the second one, $test ends up being "ZZV(abc1234);ABC(qwe12314);". So the "OE" is stripped away, although it shouldn't be. I've read about some odd results with trim when using numbers and I assume that this occurs because the OE (letter O, not number 0) represents some kind of value that is handled by the F5 differently. But can anyone tell why and how to mitigate this? Is it possible to handle the variable as a string variable or similar, so that these changes of the values are not done? Thanks in advance!264Views0likes1CommentAdvanced Resource Assign Expression Failing
I have a logging agent right before the Advanced Resource Assign with session.custom.* The variable i am testing against is shown. I cannot get the right information to display. I tried ends_with "201" and tried contains "201" but the second one will NOT load and I have no idea why. I do not see those resources on the webtop. Common:bcb3012f: Logging Agent Common:bcb3012f: session.custom.rdp.destination is 172.30.7.119 Common:bcb3012f: session.custom.rdp.domain is WORKGROUP Common:bcb3012f: session.custom.rdp.password is ********** Common:bcb3012f: session.custom.rdp.username is a Common:bcb3012f: session.custom.version is 801-201592Views0likes2CommentsBIG-IP : tcl boolean logic for string comparisons
F5 BIG-IP Virtual Edition v11.4.1 (Build 635.0) LTM on ESXi What is correct syntax for boolean operations around string comparisons ? set a "a" set b "b" set result 0 if { { $a eq "a" } && { $b eq "b" } } { set result 1 } This compiles but throws a runtime exception : expected boolean value but got " $a eq "a" " while executing "if { { $a eq "a" } && { $b eq "b" } ...341Views0likes1CommentBIG-IP : TCL to match member of set
F5 BIG-IP Virtual Edition v11.4.1 (Build 635.0) LTM on ESXi There must be a better way : if { ( $segments_count == 3 ) || ( $segments_count == 4 ) || ( $segments_count == 5 ) } { if { [expr {$name_first eq "John"}] || [expr {$name_first eq "Greg"}] || [expr {$name_first eq "Brian"}] } { NOTE: I don't want to use class matches ( as these require external data-group-files )237Views0likes2CommentsBIG-IP irule : determine page-type
F5 BIG-IP Virtual Edition v11.4.1 (Build 635.0) LTM on ESXi Request urls can be in following forms : www.gofish.com www.gofish.com/barracuda www.gofish.com/sharks/blacknose www.gofish.com/species.html www.gofish.com/bait.aspx www.gofish.com/bait.aspx?color=green I need to determine if a request is for a page ( *.html , *.aspx ) vs a resource ( barracuda , /sharks/blacknose ). More specifically, I need to determine if request is for an .aspx page.193Views0likes1CommentLoading DLLs within iRules?
Hello, Is it possible to load DLLs/SOs within I rules using the TCL load command? Something like when HTTP_REQUEST { load [file join [pwd] mylib.DLL] ... call some function from mylib... } If it's possible, is there anything special that needs to be done about the functions in mylib.DLL? Would iRules be able to infer the different return types? If it's not possible to load third-party DLLs, then is there some mechanism to access custom logic outside of the iRules?Solved453Views0likes1CommentAPM :: Detecting IE 11
Ok I suck, I know. But why is this wrong? expr { [string tolower [mcget {session.user.agent}]] matches_regex {trident\/7.+rv\:11} } It never matches... even though my UA is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; Trident/7.0; rv:11.0) like Gecko I'm using an empty branch rule with this as the 'advanced' script above. Always hits fallback (i.e. doesn't match).405Views1like3CommentsLocal Traffic Policy for creating Logging Profile
Hi All, I am working on creating a logging profile for HTTP/S virtual server for which I need help in tcl format for below logging parameters like tcl:[HTTP::host]: Virtual server name BIGIP HOSTNAME DATE and TIME CLIENT PORT POOL NAME SERVER IP SERVER PORT SNAT PORT HTTP STATUS CODE Thanks Ashish Solanki513Views0likes3CommentsIssue with HTTP_RESPONSE_RELEASE and redirect
Hi everyone, I'm pretty new to F5 and I'vea question, regarding the processing of iRules within the Virtual servers. Basically I have an irule that I use to log the requests and send a line into a pool: timing on when CLIENT_ACCEPTED { set logging_hsl [HSL::open -proto UDP -pool logging] } when HTTP_REQUEST { set requestURI "[HTTP::uri]" set virtual_server_name [getfield [virtual name] / 3] set domain "[HTTP::host]" set startTime [clock clicks -milliseconds] if {[HTTP::header "X-XXX"] ne ""} {set inXXX "[HTTP::header "X-XXX"]"} else {set inXXX "unkn"} set ts [clock format $timeInSeconds -format "%Y-%m-%dT%T.$frac" -gmt 1]Z when HTTP_REQUEST_DATA { set endRequestData [clock clicks -milliseconds] } when HTTP_RESPONSE { set now [clock clicks -milliseconds] set etimeResponse [expr {($now - $startTime)}] } when LB_SELECTED { set lt_lbPool [getfield [LB::server pool] / 3] set lt_lbServer [LB::server addr] } when HTTP_RESPONSE_RELEASE { if { [catch { ... set logging "$ts $src_addr > $virtual_server_name" HSL::send $logging_hsl $logging }] } { log local0. "Match error" } } The problem I'm having occurs in the HTTP_RESPONSE_RELEASE event in the case that a REDIRECT occurs, in which case it exits through the catch, logs the error but I lose logging that line in the pool. To solve part of the problem, I add a if { [HTTP::has_responded] } { return } block before the if { [catch , but I would also be missing the logging line. In addition, when you do the redirect, you no longer have access to the headers, so you don't have them cached and it fails. Does anyone have an idea of how I could do to be able to log that request even if it comes from a redirect?I'm struggling with this and I can't find how to avoid missing logging those requests that come out by redirect. Thanks in advance! Cheers.661Views0likes1Comment