Forum Discussion

Ankur_Goel_2526's avatar
Ankur_Goel_2526
Icon for Nimbostratus rankNimbostratus
Apr 07, 2019

Need i-rule to allow traffic for specifc URI

Need irule to pass traffic to pool member if HTTP request comes for . But if URI value is different with above URL then traffic should block and user should receive Error - 404. Also, if pool members are down then user should receive Error - 505.

 

Appreciate if there is quick response.

 

Thanks,

 

2 Replies

  • Hamish's avatar
    Hamish
    Icon for Cirrocumulus rankCirrocumulus

    Untested (But syntactically correct), try this...

    when HTTP_REQUEST {
        if { not ([HTTP::uri] equals "/net") } { 
            log local0.debug "[HTTP::uri] is not permitted to site" 
            HTTP::respond 404
        } 
    }
    
  • Give this one a try

    when HTTP_REQUEST {
        if {[active_members myPool] > 0} {
            if {!([HTTP::uri] equals "/abc")} { 
                HTTP::respond 404 content "my 404 error message"
            } 
        } else {
             myPool has no active members
            HTTP::respond 505 content "my 505 error message"
        }
    }