Forum Discussion

Luis_Melendrez's avatar
Luis_Melendrez
Icon for Altostratus rankAltostratus
Mar 29, 2017

iRule allow specific URI and block any other

Hello

 

I am trying to create an irule that will allow justanexample.com/webaccess but be able to block any other URI such

 

justanexample.com/gateway justanexample.com/admin justanexample.com/access

 

There might be more that I don't know but I was thinking on using kind of a wildmask.

 

2 Replies

  • Try:

    When HTTP_REQUEST {
    if { ([HTTP::host] eq "justanexample.com") and (not([string tolower [HTTP::uri]] eq "/webaccess")) } {
    reject
    }
    }
    
  • when HTTP_REQUEST priority 1 {
        if {[HTTP::path] starts_with "/webaccess"} {
            log local0. "[HTTP::path] Allowed.."
        } else {
            log local0. "[HTTP::path] not Allowed.."
            reject
        }
    }