Forum Discussion

irshad's avatar
irshad
Icon for Nimbostratus rankNimbostratus
Jun 02, 2020

IRULE FOR SOME URI FORWARD REST REJECT

Hi,

 

We have requirement that in URI words contains "inventory" and "price" should forward else should reject.

 

the below irule is not working

 

when HTTP_REQUEST {

 if { [string tolower [HTTP::host]] contains “price” or “inventory” } {

   forward

 } else { discard }

}

1 Reply

  • Hi,

    Can you try this:

    when HTTP_REQUEST {
        if { ([HTTP::uri] contains "inventory") || ([HTTP::uri] contains "price") } {
            pool /your-pool
        }  else {
           discard
        }
    }

    Instead of pool you could also ure return and make sure your virtual server has a default pool.

    Cheers,

    Kees