Forum Discussion

jayanthi_41101's avatar
jayanthi_41101
Icon for Nimbostratus rankNimbostratus
Aug 31, 2011

Multiple irules that have same events

I have 2 irules that have 2 datagroups and redirects to different pool but handles the same events HTTP_REQUEST and HTTP_RESPONSE.

 

 

Will all the requests go through both irules even if the data matches with only one of the datagroup?

 

 

 

Is it the first match that will happen or will both irules be passed through irrespective of whether it matches or not?

 

14 Replies

  • Hi Puli,

     

     

    That can get complicated without seeing exactly what you are trying to accomplish, especially when logic is separated into different iRules.

     

     

    Without knowing all of that I would suggest integrating all 8 iRules into a single iRule (temporarily) to make sure that you have the flow correct and that you do not have conflicting logic (if you have the possibility of conflicting logic make sure that you use return statements to prevent further processing within the iRule preventing conflicts).

     

     

    After you have the logic flow correct you note the proper priorities to assign to the HTTP Events and then split them back out into separate iRules with the proper priorities if needed.
  • BTW, the iRule with the HTTP_RESPONSE event will trigger regardless of the others' priorities as a response naturally occurs after a request. You can set a variable for the header value to be inserted as part of the request event.

     

  • Puli's avatar
    Puli
    Icon for Nimbostratus rankNimbostratus
    thanks for the responses.

     

    Our website has numerous applications that hang off of it. Applications based on URL.

     

    We are modularizing the code so we mess up other applications code when there is a change to a particular appliction.

     

     

    Here is an example.

     

    www.abc.com/ - Main iRule priority 100

     

    www.abc.com/app1 - application 1, priority 200

     

    www.abc.com/app2 - application 2, priority 300

     

    www.abc.com/app3 - application 3, priority 400

     

     

    HTTP_RESPONSE.

     

    common code : remove cache-control header

     

    specific code : Add header "Application : Application " (this will the variable set in each of the HTTP_REQUEST iRule.

     

     

    My confusion and need advise here is.

     

    Can i a seperate iRule for just the http_response without any priority ?

     

    or do i need to set priority to 1000 so it get triggred at last ?

     

     

    thanks,

     

    Puli