simonbaumann_12
Feb 15, 2013Nimbostratus
iRule to redirect URI based on source ip.
Hello,
I am looking for a rule to fullfill the following requirement: redirect the url https://host.test/content/ to an new url https://newhost.test for all ip source addresses. There is another page running: https://host.test/content/Admin.aspx
This page should only be available for specific source ip addresses. I was able the restrict the access to the Admin page with the following rule:
when CLIENT_ACCEPTED {
if { [IP::addr [IP::client_addr] equals xxx.xxx.xxx.0/24] } {
pool POOL_ADDRESS
}
}
I am using this rule for the url redirect:
when HTTP_REQUEST {
if { ! ([HTTP::uri] contains "/content/")}
{HTTP::redirect "https://newhost.test"
}
}
The problem is, that the rule matching the ip addresses hits first, which prevents the url redirect rule to work. How could I combine these rules? Thanks for your help.
Regards
Simon