Learn F5 Technologies, Get Answers & Share Community Solutions Join DevCentral

Filter by:
  • Solution
  • Technology
Answers

IP Address based iRule

Im trying to block
---[HTTP::uri]] contains "/_grid/print/print_data.aspx"
from everyone with an IP not 10.0.0.0/8

I have one iRule.

when HTTP_REQUEST {
if { [string tolower [HTTP::uri]] contains "/_grid/print/print_data.aspx" } {
HTTP::redirect "http://google.com"
}
}

I know that I can have the below somewhere but its just not adding up..

"inside network"-> if { [IP::addr [IP::client_addr]/8 equals 10.0.0.0] }



thanks for any direction.
BIG-IP 9.4.1 Build 29.2
R.
0
Rate this Question

Answers to this Question

placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER
Like this?

 
when HTTP_REQUEST {
if { [string tolower [HTTP::path]] ends_with "/_grid/print/print_data.aspx" and (not ([IP::addr [IP::client_addr]/8 equals 10.0.0.0]))} {
HTTP::redirect "http://google.com"
}
}


Some of the parentheses might not be needed.

Aaron
0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER
Perfection!!!!!

I dropped it in and everything worked 100%.... thanks for the help!

Ryan
0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER
Sharp looking rule. Simple, efficient, and a cool example of how to use iRules for something I don't see every day in the forums. Dig it.

#Colin
0