Forum Discussion
Tim_W_72292
Nimbostratus
Oct 24, 2007Irule with Multiple HTTP checks
Hi All,
I am trying to write a rule that will do multiple check within the HTTP headers, is this possible? Here is what I was thinking:
if {[HTTP::host] equals and [HTTP::status] equals "400" and [HTTP::uri] starts_with "/url"} {
log local0, "log of issue"}
}
Will this work as I think it will or are there constraints on the HTTP headers checks?
Cheers
Tim
15 Replies
- Tim_W_72292
Nimbostratus
Aaron,
I have had a play around with the monitors and I cannot get the functionality that I need from them as, the system that this BigIp is being used by, is posting messages to a url so if I configured a monitor it would end up in lots af messages being sent and they would have to be retrieved. I am looking at the LB::down docs now. Is there a linkt to all the irules documentation, I have some here but this LB::down is not mentioned.
Cheers
Tim - Tim_W_72292
Nimbostratus
I have changed this a little after checking out what else I need to do, does it look ok?
when HTTP_REQUEST {
If request is for the message store, set a variable to log the client/server IP's if the response is a 400
if {[HTTP::path] starts_with "/MmscServletApp/DeliveryFailureSyncServlet"}{
set check_response 1
} else {
set check_response 0
}
}
when HTTP_RESPONSE {
If the request was for the message store, check if HTTP response status is a 200
if {$check_response && [HTTP::status] == 400}
log local0. "[IP::client_addr] -> [IP::server_addr] for the login page generated a HTTP 400 response, node will be disabled"
set n [IP::server_addr]
LB::down node $n
} elseif {$check_response && [HTTP::status] not equals 200}
set r [HTTP::status]
log local0. "[IP::client_addr] -> [IP::server_addr] for the login page generated a HTTP $r response"
}
}
Cheers
Tim - hoolio
Cirrostratus
A couple of suggestions:
If you have multiple services on the pool member being load balanced through the BIG-IP, it might actually be better to disable just the one service that is failing. Instead of using LB::down node 1.1.1.1, you could use 'LB::down pool member '. If the node is in multiple pools and you want to mark it down in all pools, you could use LB::down node 1.1.1.1 to mark it down in all pools.
You can make it slightly more efficient by not saving the command output to a variable:
This:set n [IP::server_addr] LB::down node $n
can be replaced with this:LB::down node [IP::server_addr]
Likewise, this:set r [HTTP::status] log local0. "[IP::client_addr] -> [IP::server_addr] for the login page generated a HTTP $r response"
can be replaced with:log local0. "[IP::client_addr] -> [IP::server_addr] for the login page generated a HTTP [HTTP::status] response"
Aaron - Tim_W_72292
Nimbostratus
I have just discovered that the BigIp that this was designed for is only running 9.1.2 so i am unable to use the LB::down function, is there any other way to do this?
Cheers
Tim - hoolio
Cirrostratus
Hi Tim,
I don't believe there is an equivalent in 9.1.x. It would be good to upgrade from 9.1.2 to 9.3.x anyhow as there have been a lot of issues fixed in the latest maintenance release.
Aaron
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
