Supahoopsa_8892
Jun 10, 2011Nimbostratus
IRule not working - sytnax error or something else?
I have tried writing my first iRule to check the url of my site and then depending on which site the user is attempting to access, I then check a list of approved IP addresses.
If the clients IP address is not found in the list, I redirect them to an unauthorised page, otherwise I let them through.
This is my code:
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::uri]] {
"*XXX*" {
if not { matchclass [IP::client_addr] equals $::XXX_access_list } {
HTTP::redirect https://MyXXXUnauthPage.com
}
}
"*YYY*" {
if not { matchclass [IP::client_addr] equals $::YYY_access_list } {
HTTP::redirect https://MyYYYUnauthPage.com
}
}
"*ZZZ*" {
if not { matchclass [IP::client_addr] equals $::ZZZ_access_list } {
HTTP::redirect https://MyZZZUnauthPage.com
}
}
}
}
Is there a syntax error here or have I just gor my logic wrong.
Any help would be GREATLY appreciated.