Forum Discussion

SSHSSH_97332's avatar
SSHSSH_97332
Icon for Nimbostratus rankNimbostratus
May 18, 2012

ASM IRule to associate to a Class

i want to check sourec IP of a client , if it is X.X.X.X then assign HTTP Class X , else assign HTTP Class Y .

what is the needed IRule ?

 

 

 

4 Replies

  • George_Watkins_'s avatar
    George_Watkins_
    Historic F5 Account
    SSHSSH,

     

     

    To my knowledge you cannot assign HTTP class profiles from within an iRule. "Hosts" are one of the parameters that you can match on when assigning an HTTP class. You could use the PROFILE::httpclass command to identify the assigned HTTP class and take action in your iRule, but the command is read-only. Could you write an iRule that uses a data group to store the IP addresses and outcomes for your clients?

     

     

    -George
  • nathe's avatar
    nathe
    Icon for Cirrocumulus rankCirrocumulus
    SSHSSH,

     

     

    I must admit I did think you can, although I've never tried or tested this. This is the iRule I came up with but after reading George's post my instincts tell me I must be wrong - as I'm nowhere near his level of expertise. Anyway, apologies in advance if I'm wrong but here goes:

     

     

    when HTTP_REQUEST {

     

    if { [IP::addr [IP::client_addr] equals x.x.x.x] } {

     

    HTTP::class select httpclassx

     

    } else {

     

    HTTP::class select httpclassy

     

    }

     

    }

     

     

    If you check out the http::class wiki here: https://devcentral.f5.com/wiki/iRules.http__class.ashx it says "Note: the HTTP class must already be configured on the virtual server"

     

     

    Be great to get feedback if it works, or find out where I've gone wrong....especially as I'm contradicting a Devcentral Teamer.

     

     

    Rgds

     

    N
  • George_Watkins_'s avatar
    George_Watkins_
    Historic F5 Account
    Wow! Now I feel like an idiot. I don't know how I missed that. I guess that's what I get for browsing late on a Friday night after a long week. I've only used the PROFILE::httpclass command once, but I 've never even noticed that HTTP::class. I apologize to have led you astray. Listen to Nathan, he's knows what he's doing. :-)

     

     

    Sorry guys,

     

     

    -George