Hello,
I have this irule and it’s working fine but now i have to add a new ipaddress in the range C.D.0.0/16. How can i do this?
when HTTP_REQUEST { if {not ([IP::addr [getfield [IP::client_addr] “%” 1] equals A.B.0.0/16]) } { set my_loc “https://[HTTP::host][HTTP::uri]” TCP::respond “HTTP/1.1 301 Moved Permanently\r\nLocation: $my_loc\r\nConnection: close\r\nContent-Length: 0\r\n\r\n” TCP::close
} }
Greetings, Fred
This should do the trick.
when HTTP_REQUEST {
if { not ([IP::addr [getfield [IP::client_addr] "%" 1] equals A.B.0.0/16] || [IP::addr [getfield [IP::client_addr] "%" 1] equals C.D.0.0/16]) } {
HTTP::respond 301 noserver Location "https://[HTTP::host][HTTP::uri]" Connection close
TCP::close
}
}
Hi Brad,
Thanks for your answer but it’s not working. If the ip-address is C.D.A.A then the first part of the rule is already triggered.
It has to be something like “if not ip A.B.0.0/16 or if not C.D.0.0/16 then ..” But I can’t figure out what the syntax must be ..
Greetings, Fred
I over looked how the not would affect the elseif, I have updated it to use an OR(||). This should do the trick.
Hi Brad,
Yep that did it! Thanks for your support!!
Greetings, Fred Zandvliet