Forum Discussion

islam_nadim's avatar
Jun 12, 2020
Solved

Multiple iRules on Same VS not working

Hello guys, I have 2 iRules similar to each other, with the only difference is the URI. Only the first iRule gets triggered, either apply the iRule or skip, based on the URI Tried to merge t...
  • youssef1's avatar
    youssef1
    Jun 15, 2020

    Hello,

    Yes you can easly.

    The simple way to achieve your need is to merge your irule.

    when RULE_INIT - Will allow you to set an var

     when CLIENT_ACCEPTED - L4, yo can't manage restriction based on URI

    when HTTP_REQUEST - you can manage URI/URL (L7)

    when HTTP_RESPONSE - http response L7

    Example:

    when RULE_INIT {
    	set static::myVariable "some string"
    }
     
    when CLIENT_ACCEPTED {
    ...
    }
     
    when HTTP_REQUEST {
    witch -glob [string tolower [HTTP::path]] {
    	"/uri1" {
    		# Apply your need 1
    	}
    	"uri2" {
    		# Apply your need 2
    	}
    	default {
    		# Apply your default need
    	}
    }
     
    when HTTP_RESPONSE {
    ...
    }

    you just have to manage all your uses cases well and sequence the actions...

    if you send me your irules privately i can do it for you.

    regards