irule to stop access to URL /login* from outside and permit access exclusevely from 172.0.0.0/8 subnet (internal)

Hello , Im trying to use the below Irule to stop access to URL including “/login.aspx” from outside except for internal network 172.0.0.0/8

But the page is not working from inside also when applying irule and returning message :“secure connection failed”

when HTTP_REQUEST { switch -glob [string tolower [HTTP::uri]] { “/login*” {

if { not ( [IP::addr [IP::client_addr] equals 172.0.0.0/8] ) } {

reject } } default { return } } }

thanks in advance.

Best Regards, Ralph El Habr

You can try this code:

when HTTP_REQUEST {
    if { [string tolower [HTTP::uri]] starts_with "/login " && ![IP::addr [IP::client_addr] equals 172.0.0.0/8]} {
        HTTP::respond 403 -version "1.1" content {Access Denied.}
    }
}