szia_80879
Sep 23, 2008Nimbostratus
Redirect request using multiple conditions
Hello everyone,
I am having trouble making an iRule works. I could not figure out what is causing this issue. Let me explain what I want to accomplish with the iRule.
I have two URIs: “/” is for external users and “/xyz” for internal users. I want to use two conditions to separate the external request from internal request.
First condition: Users are allow to use either [HTTP::host/] or [HTTP::host]/xyz
Second condition: User will be redirected to external or internal site based on their source addresses.
I wrote a test iRule. It works only for the external URI. It does not work for internal URI and creates a loop. My Big-IP log file is getting hammered with these loop entries when I tested. Please help me to find what is in the iRule is causing this loop. Any help will be appreciated. Thank you in advance.
when HTTP_REQUEST {
if { [HTTP::uri] equals "/" or ([HTTP::uri] ends_with "/xyz")} {
if { [matchclass [IP::client_addr] equals $::restricted_client_datagroup]} {
HTTP::redirect http://[HTTP::host]/xyz
}
pool Corporate_8080_Pool
} else {
if { not [matchclass [IP::client_addr] equals $::restricted_client_datagroup]} {
HTTP::redirect http://[HTTP::host]/
}
pool Corporate_8080_Pool
}
log the client IP address -> destination IP address
log local0. "request accepted from client: \
[IP::client_addr] -> [IP::local_addr] -> [HTTP::uri]"
}