Forum Discussion
pelle_71294
Nimbostratus
Jul 08, 2010iRule Redirection Problem
Hi,
Got a few iRule problems. My main problem is that I usually don't configure our F5 BigIPs very often and the guy doing it is not available.
The problem is that I thought I had created a maintenance iRule based on some simple requirements that will redirect requests based on source-ip and url. However when I now got a chance to test it, it won't work as I expected.
Would very much appriciate any pointers to what I have done wrong with this.
when HTTP_REQUEST {
if { ! [matchclass [IP::client_addr] equals $::acl_mycompany_nets]
|| ! [matchclass [URI::decode [string tolower [HTTP::uri]]] contains $::acl_maintenance]} {
HTTP::redirect http://www.mycompany.com/maintenance/index.php
}
}
It's using the two data lists.
acl_mycompany_nets contains 2 networks for the sake of example. 10.10.0.0/22 and 172.16.0.0/23.
acl_maintenance contains /callback/ /maintenance/ and /pictures/
It redirects as it should to /maintanence/index.php
But when I click a link on that go to /maintenance/pictures//index.php it just goes back to /maintenance/index.php, same thing for /callback//index.php
Both returns to /maintenance/index.php
- hoolio
Cirrostratus
I assume you want to allow your company nets users to access the pool regardless of whether maintenance is being done? If so, can you try this? If it doesn't work as you'd like, you can uncomment the debug log lines and check /var/log/ltm for the output:when HTTP_REQUEST { log local0. "[IP::client_addr]:[TCP::client_port]: [HTTP::method] for [HTTP::host][HTTP::uri]" if { [matchclass [IP::client_addr] equals $::acl_mycompany_nets] } { log local0. "[IP::client_addr]:[TCP::client_port]: Client is in acl_mycompany_nets class. Exiting" Client is a corporate user, so exit the iRule and don't redirect them return } else { log local0. "[IP::client_addr]:[TCP::client_port]: Client is not in acl_mycompany_nets class. Checking URI." if { ![matchclass [URI::decode [string tolower [HTTP::uri]]] contains $::acl_maintenance] } { log local0. "[IP::client_addr]:[TCP::client_port]: Client is not in acl_mycompany_nets class and URI check failed. Redirecting." HTTP::redirect http://www.mycompany.com/maintenance/index.php } } }
- pelle_71294
Nimbostratus
Hi Aaron, - hoolio
Cirrostratus
Are you sure you have a datagroup named exact acl_maintenance? Is it a type string datagroup? - pelle_71294
Nimbostratus
Yes. Checked so many times I lost count now. It's a string data group. - hoolio
Cirrostratus
That's odd. If you run 'b class acl_maintenance list' to you get a result back? - pelle_71294
Nimbostratus
No I don't. I get parsing error for some reason. - hoolio
Cirrostratus
If you have full command line access, can you run this instead and reply with the output: - pelle_71294
Nimbostratus
Ok, it's pretty obvious I need sleep now. Sorry for taking up your time. Been checking it again and again and again.
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