Forum Discussion
Deb_Allen_18
May 18, 2005Historic F5 Account
matchclass syntax / allowed operators
is this valid syntax for matchclass?
[matchclass $inbound_uri starts_with $::uri_redirects]
I'm trying to redirect based on a variable length leading directory in the URI string.
Here's the relevant parts of the rule with the ultimate intention of redirecting all request for /ambulance* to the corresponding URI built from the 2nd field in the class:
when HTTP_REQUEST {
set inbound_uri [string tolower [HTTP::uri]]
if { [matchclass $inbound_uri starts_with $::uri_redirects] } {
set inbound_pid [getfield [findclass [substr $inbound_uri 1 /] $::uri_redirects] " " 2]
HTTP::redirect "http://host.domain.com/dir1/dir2/index.jsp?id=a0a0164000000ff706071f000000006&pid=${inbound_pid}&ptype=list"
}
}
Class uri_redirects contains members like:
"/ambulance "
thanks for any insight regarding matchclass syntax and allowed operators, or just a better way to build the mousetrap...
cheers!
/deb
- Colin_Walker_12Historic F5 AccountDeb,
- unRuleY_95363Historic F5 AccountBTW, as of 9.0.4 the following line:
set inbound_pid [getfield [findclass [substr $inbound_uri 1 /] $::uri_redirects] " " 2]
set inbound_pid [findclass [substr $inbound_uri 1 /] $::uri_redirects " "]
- Deb_Allen_18Historic F5 Accountexcellent, thank you both!
- unRuleY_95363Historic F5 AccountThe main difference for the equality operators is between "==" and "eq". "equals" is merely an F5 synonym for "eq". The difference is that Tcl treats "eq" as a string comparison only. So, the operands of the operator are always converted to string form and then compared. The "==" operator is slightly different in that the operands are first tested to see if they are of the same type and compared in their native type (for example, two integers would be compared as integers instead of converted to strings and then compared). For the most part, the result would likely be the same using either operator, however using the "eq" operator on non-string operands could have strange side effect and/or an impact on performance.
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