mod_rewrite to iRule conversion question from a newcomer
Hi Folks,
I'm fairly new to the BIGIP devices, though I've used competitors products before so I'm not starting from scratch. I have a mod_rewrite rule that I'm trying to migrate from our Apache servers onto the BIGIPs, this is one of many but I'm having particular difficulty with this one.
My main issue seems to be a lack of understanding on how to handle negative matches in condition statements when it's not a simple x != y statement.
The mod_rewrite rule is as follows:
RewriteCond %{REQUEST_URI} !\..*$
RewriteCond %{REQUEST_URI} !^/$
RewriteCond %{REQUEST_URI} !^/server-status$
RewriteRule ^/(.*) /redirect.jsp?code=$1 [NE,L,R=301]
So if the URI is not ending with .* or / (or a request to /server-status) then pass the URI to /redirect.jsp as a parameter.
I've been trying to avoid using matches_regex so have been focusing on ends_with or equals for performance reasons, but I've been falling at the first hurdle...
when HTTP_REQUEST {
if { not [ [HTTP::uri] ends_with ".*" ] } {
log local0. "url didn't match .*"
}
}
I'm guessing I will want a switch in here when I get it working once, but how do I get it to *not* match ends_with rather than match it?
I get the following thrown:
invalid command name "/home.jsp" while executing "[HTTP::uri] ends_with ".*" "
Thanks in advance for any help.
Richard.