Forum Discussion
hooleylist
Jan 30, 2012Cirrostratus
string trimleft operates by removing characters not words. So a is part of the characters you have in your "trim" list so it's removed from the source string. If you want to chop off /chart, you could use string range or scan:
string range [HTTP::uri] 7 end
scan [HTTP::uri] {/charts%s}
string range should be more efficient:
% time {string range $uri 7 end} 1000
1 microseconds per iteration
%
% time {scan $uri {/charts%s}} 1000
2 microseconds per iteration
Also, the value for HTTP::uri, HTTP::path and other HTTP:: commands was cached in the same iRule and event in 9.x and 10.x. This was fixed in v11. Until you upgrade to v11, you'll see the original value when logging, modifying and then logging the values for the HTTP:: commands. The value is actually changed though.
when HTTP_REQUEST {
if {[string tolower [HTTP::uri]] starts_with "/charts"}{
HTTP::redirect "http://ifp-vip:8080[string range [HTTP::uri] 7 end]"
log local0. "redirecting to http://ifp-vip:8080[string range [HTTP::uri] 7 end]"
}
}
Aaron