Forum Discussion
MikeStearns_600
Nimbostratus
Jan 29, 2009HELP with a new irule...disable acceleration
Hello. I am looking to create an irule to do the following:
If the request doesn't end with /abc123.html
AND
if the request doesn't begin with /CPOS2
AND
if the request doesn't begin with /NEXTAPP
THEN
disable acceleration
AND
disable LTM cache
This is what I have so far. I would appreciate any help. I am new to writing code.
when HTTP_REQUEST {
if { not ( [HTTP::uri] ends_with "/abc123.html" && not ( [HTTP::uri] begins_with "/CPOS2" && not ( [HTTP::uri] begins_with "/NEXTAPP") } {
HTTP::class disable
CACHE::disable
}
7 Replies
- Colin_Walker_12Historic F5 AccountWhen you say "disable acceleration" what exactly are you looking to do?
Regardless, your code is close but you were missing a few closing parens. This should work a little better if disabling the class and the cache is really what you want to do.when HTTP_REQUEST { if { (not ( [HTTP::uri] ends_with "/abc123.html")) && ( not ( [HTTP::uri] begins_with "/CPOS2")) && (not ( [HTTP::uri] begins_with "/NEXTAPP")) } { HTTP::class disable CACHE::disable } }
Colin - MikeStearns_600
Nimbostratus
We want to disable the IBR feature while adding new applications to the F5. I guess we prefer doing an iRule instead of a WA policy change. For example.....we would be able to setup the policy prior to production and the only change for us to do would be deleting the iRule for the new application to go productive.
I really appreciate the help. - MikeStearns_600
Nimbostratus
I seem to be getting the following error when trying to create the irule above.
01070151:3: Rule [nextapp_going_live] error:
line 2: [parse error: PARSE syntax 98 {syntax error in expression " (not ( [HTTP::uri] ends_with "/abc123.html")) && ( not ( [H...": looking for close parenthesis}] [{ (not ( [HTTP::uri] ends_with "/abc123.html")) && ( not ( [HTTP::uri] begins_with "/CPOS2")) && (not ( [HTTP::uri] begins_with "/NEXTAPP")) }]
Here is the irule again.
when HTTP_REQUEST {
if { (not ( [HTTP::uri] ends_with "/abc123.html")) && ( not ( [HTTP::uri] begins_with "/CPOS2")) && (not ( [HTTP::uri] begins_with "/NEXTAPP")) } {
HTTP::class disable
CACHE::disable
}
} - JRahm
Admin
The operator should be starts_with instead of begins_with - hoolio
Cirrostratus
Also, I think 'HTTP::class disable' disables the class selection for the duration of the TCP connection. You may want to enable it if the checks aren't true. I think CACHE::disable isn't subject to this as the caching decision is done on each request/response. You could check this by making one matching request and one non-matching request over the same TCP connection and check the debug logging.
Also the AND'd NOTs are a little difficult to follow. Maybe something like this would be easier?when HTTP_REQUEST { Check if URI matches these checks switch -glob [HTTP::uri] { "*/abc123.html" - "/CPOS2*" - "/NEXTAPP*" { log local0. "[IP::client_addr]:[TCP::client_port]: Not disabling caching/enabling class selection for [HTTP::uri]" HTTP::class enable } default { log local0. "[IP::client_addr]:[TCP::client_port]: Disabling caching/class selection for [HTTP::uri]" HTTP::class disable CACHE::disable } } }
Aaron - MikeStearns_600
Nimbostratus
Thanks Aaron. If this does what i need, which section do I take out to stop the debug logging? I hope to test later this week. - hoolio
Cirrostratus
To disable the logging, you can comment out the log lines with a hash:
log local0. "..."
or remove them altogether.
Aaron
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
