Forum Discussion

CraigM_17826's avatar
CraigM_17826
Icon for Altocumulus rankAltocumulus
Feb 17, 2010

iRules and HTTP classes

Just a quick one,

 

 

Are iRules processed before HTTP classes? I have a situation where I am migrating a lot of iRule based redirects/pools to HTTP classes but I have one situation where one of two pools is to be used under a certain condition and I can't seem to work out how to do that using a HTTP class so I'll probably have to leave it in the iRule. I'm just not sure which get processed first.

 

 

tia

 

 

Craig
  • hoolio's avatar
    hoolio
    Icon for Cirrostratus rankCirrostratus
    Hi Craig,

     

     

    Can you post the current iRule code you're trying to replace with HTTP classes?

     

     

    For a standard HTTP VIP with an HTTP class, I'd expect the following events to be triggered:

     

     

    CLIENT_ACCEPTED - TCP connection from client to VIP established

     

    HTTP_REQUEST - client's HTTP request headers parsed

     

    HTTP_CLASS_SELECTED (if a matching class is found for a request) or HTTP_CLASS_FAILED (if no matching class is found for a request)

     

    LB_SELECTED - pool member selected

     

    SERVER_CONNECTED - TCP connection from LTM to server established

     

    HTTP_REQUEST_SEND - just before the HTTP request is sent to the server

     

    HTTP_RESPONSE - server's HTTP response headers parsed

     

    SERVER_CLOSED - LTM to server connection closed

     

    CLIENT_CLOSED - client to VIP connection closed

     

     

    There are probably a lot of exceptions/additions to this, but I think that list covers the basics.

     

     

    For details on the events, you can check the wiki page:

     

     

    http://devcentral.f5.com/wiki/default.aspx/iRules/events

     

     

    Aaron
  • Hi Aaron,

     

     

    Here's the code. At the moment it basically just checks for the status of the pool members to see if at least one of them is up and if so directs the traffic there. If no pool members are avaiable then it directs to an alternate pool whose members are responsible for displaying error page.

     

     

    I will be changing the failed confition pool to a either a redirect or uri rewrite since they have created a new error message page within our web apoplication (WebSphere). Originally they intended to host it on a seperate IIS server.

     

     

      
       if { [string tolower [HTTP::uri]] contains "/new-services/" } {   
          if { [active_members "New-Services"] > 0 } {     
             pool "new-services"   
             return   
         } else {   
            pool "new-services-down"   
            return    
        }     
       }   
      

     

     

    I just couldn't see how I could replicate this with HTTP classes.

     

     

    Craig
  • hoolio's avatar
    hoolio
    Icon for Cirrostratus rankCirrostratus
    Hi Craig,

     

     

    You can't check the pool availability with an HTTP class, so you'll need to stick with the iRule for this one.

     

     

    Aaron