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 } {
I’ve just applied the changes with your recommendations, but it appears we’re still having problems with the matchclass aspects. I wanted to state that I created “site_access_list” as a Data Group in the BIGIP UI. It contains multiple Host and Network addresses. Anything I should be considering on that?
If you’re on 9.4.4 or higher you should remove the $:: prefix from the datagroup name. It will demote the iRule from CMP in any version, but won’t work at all to access the datagroup in v10+: