Forum Discussion
Malcom_Sargla_6
Nimbostratus
Oct 12, 2007Simple Http Redirect.. double 'IF' statement
Dear Central..
I am very new to Irules and really could use some assistance with one that I am working on.. again very new so I do apologize in advance if this is very basic.
1) Client request will come in via HTTPs with uri = xxx
2) AND if they belong to proper range within 'test' redirect to external webserver
3) everyone else with uri = xxx is to use default_pool..
when HTTP_REQUEST {
if [HTTP::uri] starts_with $::/xxx } {
if { [matchclass [IP::client_addr] equals $::test] } {
HTTP::redirect "http://xxx.why.not.net/[HTTP::uri]"
} elseif [HTTP::uri] starts_with $::/pfs } {
pool default_pool
}
}
Thank you in advance.
ms.
- Deb_Allen_18Historic F5 AccountThis iRule will redirect only clients in that IP class list who request URI's in that specific path. All other requests (those from other IP addresses or for other URI paths) will go to the default pool:
when HTTP_REQUEST { if {([matchclass [IP::client_addr] equals $::test]) && \ ([string tolower [HTTP::uri]] starts_with "/xxx")}{ HTTP::redirect "http://xxx.why.not.net[HTTP::uri]" } else { pool myPool } }
- Malcom_Sargla_6
Nimbostratus
Dear Deb; - dennypayne
Employee
That's because "pfs" in your example is part of the host, not the URI. So you need: - dennypayne
Employee
EDIT: oops, removed the slash before pfs - Malcom_Sargla_6
Nimbostratus
Hello Deb, Dennypayne; - Colin_Walker_12Historic F5 AccountThe string tolower command takes whatever information you pass it, HTTP::uri in this case, and turns it into lowercase for the duration of the comparison that's being made.
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