Forum Discussion
SSHSSH_97332
Nimbostratus
May 18, 2012ASM 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_Historic F5 AccountSSHSSH,
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
Cirrocumulus
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_Historic F5 AccountWow! 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 - SSHSSH_97332
Nimbostratus
Thanks all
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects