1

On apache we have the following RewriteCond to block url's with a word in it.

<br/> 
RewriteCond %{QUERY_STRING} guest [NC]<br/>
RewriteRule .* - [F]<br/><br/>

How can we transfer this condition to an irule so we can put this on the F5 Loadbalancer?

Paul Dawson
  • 1,332
  • 14
  • 27
fabje
  • 29
  • 1
  • 7

1 Answers1

0

This will also create a log for each time the event occurs.

when HTTP_REQUEST {
 if {([HTTP::uri] contains "guest")} { 
log local0.alert "Rejecting \"[HTTP::host][HTTP::uri]\"guest request from [IP::client_addr]" 
reject
} 
} 
Paul Dawson
  • 1,332
  • 14
  • 27
  • And do I need to use escapes if in the word/url are symbols like = or - ? so as an example user=guest – fabje Sep 11 '19 at 13:21
  • No, not if they are within the quotes - have a look here https://devcentral.f5.com/s/articles/irules-optimization-101-04-delimiters-braces-brackets-quotes-and-more and here https://cmdref.net/hardware/bigip/irule_sample.html for more examples: – Paul Dawson Sep 11 '19 at 13:36