Forum Discussion
Craig_17655
Nimbostratus
Aug 14, 2009iRule for Redirrecting based upon URI
I am trying to replace some apache functionality using iRules. I have the following rules set up in apache:
SetHandler matrix
SetCluster imgserver
So basically, if the URI contains .img I send the request to a different set of servers that handles the requests.
I am looking for advise as I am new to irules and have not found many examples. I think it is something like this:
when HTTP_REQUEST {
set uri [HTTP::uri]
if { $uri contains ".img" }
pool testpool2
}
else {
pool testpool
}
Any help would be greatly appreciated.
- The_Bhattman
Nimbostratus
Hi,when HTTP_REQUEST { if { [HTTP::uri] contains ".img" } { pool testpool2 } else { pool testpool } }
when HTTP_REQUEST if {([HTTP::host] eq "www.yourdomain.com") and ( [HTTP::uri] contains ".img" ) } { pool testpool2 } else { pool testpool } }
- Don't forget the "equals" between the host and www.yourdomain.com comparison.
...([HTTP::host] equals "www.yourdomain.com")...
- The_Bhattman
Nimbostratus
Thanks Joe. I don't know what I was thinking. - hoolio
Cirrostratus
You could be more specific and check for a path ending in .img: - Craig_17655
Nimbostratus
Through support from F5 I found that I should use HTTP:path instead of HTTP:uri
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