jaskel_40663
Apr 29, 2008Nimbostratus
Block specific URI
I have a need to block a specific uri as well as insert the client IP address into the HTTP header. I have the HTTP header insertion iRule and it works well:
when HTTP_REQUEST {
while {[HTTP::header exists "Client-IP"]} {
HTTP::header remove "Client-IP"
}
HTTP::header insert "Client-IP" [IP::client_addr]
}
My question is this: Can I add another iRule that has a 'when HTTP_REQUEST' directive to block a uri with specific text in it, to the VS, or should I just incorporate it into the above rule?
when HTTP_REQUEST {
if{[HTTP::uri] contains "server-status"} {
HTTP::respond 200 content "Error"
}
while {[HTTP::header exists "Client-IP"]} {
HTTP::header remove "Client-IP"
}
HTTP::header insert "Client-IP" [IP::client_addr]
}
It seems to me that this might still fall through to the while statement, plus, since I use the header insertion in many VSs, perhaps another iRule for specific VSs to block the uri would be better?
I appreciate any and all comments! Thanks so much.
-Jas