Forum Discussion
URL and IP check iRule
- Dec 04, 2016
when HTTP_REQUEST { switch -glob [HTTP::path] { "*/g2b*" { pool G2B_Pool } "*/portal/g2c*" { pool G2C_Pool } "*/_layout/15*" { if { [IP::client_addr] matches_glob "10.10.10.1\[01\]" } { pool G2B_Pool } } } }
I removed the CLIENT_ACCEPTED code because, unless poolDefault is actually utilized elsewhere. I also removed the default branch (the else clause in the original code). If the pool associated with the Virtual Server is already set to B2B_Pool, then the default branch is redundant. Finally, I removed the string tolower for the path. Whether it makes sense depends on the path semantics for the webserver. See the Analysis section in this recipe for more details:
when HTTP_REQUEST {
switch -glob [HTTP::path] {
"*/g2b*" { pool G2B_Pool }
"*/portal/g2c*" { pool G2C_Pool }
"*/_layout/15*" {
if { [IP::client_addr] matches_glob "10.10.10.1\[01\]" } {
pool G2B_Pool
}
}
}
}
I removed the CLIENT_ACCEPTED code because, unless poolDefault is actually utilized elsewhere. I also removed the default branch (the else clause in the original code). If the pool associated with the Virtual Server is already set to B2B_Pool, then the default branch is redundant. Finally, I removed the string tolower for the path. Whether it makes sense depends on the path semantics for the webserver. See the Analysis section in this recipe for more details:
Hi Vernon
actually i am using default pool to redirect the traffic hitting the default URL (without /g2b or /g2c)
i want to add other condition for "/_layout/15" to check if ip= 10.10.10.61 or 10.10.10.63 then will redirect the traffic to pool g2c.
Recent Discussions
Related Content
* 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