Forum Discussion
Robert_47833
Altostratus
Apr 16, 2012something interesting in if {if } else
irule
if {($uri matches "/cjj" or $uri matches "/cjj/") } {
if { [HTTP::host] ends_with ".co.uk" } {
HTTP::redirect "http://[HTTP::host]/error.html"
return
}
}
else {
pool xxxx
}
http://www.ss.com/cjj doesn't hit pool xxxx,why?
this url doesn't match ".co.uk",why irule doesn't pass it to else?
3 Replies
- hoolio
Cirrostratus
Hi Jucao,
www.ss.com/cjj would match the first if but not the second. So it wouldn't hit the pool statement. If you want to use that pool for www.ss.com/cjj, you could try this:if {($uri matches "/cjj" or $uri matches "/cjj/") } { if { [HTTP::host] ends_with ".co.uk" } { HTTP::redirect "http://[HTTP::host]/error.html" return } else { pool xxxx } } else { pool xxxx }
Aaron - Robert_47833
Altostratus
ok,I see
once /cjj is matched,but no action is in irule,F5 will send fallback host(fallback host is configured) to client,right? - nitass
Employee
yes[root@ve1023:Active] config b virtual bar list virtual bar { snat automap destination 172.28.19.79:80 ip protocol 6 rules myrule profiles { myhttp {} tcp {} } } [root@ve1023:Active] config b profile myhttp list profile http myhttp { fallback "http://www.google.com" } [root@ve1023:Active] config b rule myrule list rule myrule { when HTTP_REQUEST { set uri [HTTP::uri] if {($uri matches "/cjj" or $uri matches "/cjj/") } { if { [HTTP::host] ends_with ".co.uk" } { HTTP::redirect "http://[HTTP::host]/error.html" return } } else { pool foo } } } [root@ve1023:Active] config curl -I http://www.ss.com/cjj HTTP/1.0 302 Found Location: http://www.google.com Connection: close
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
