Forum Discussion
Chris_G_Davis_1
Nimbostratus
Nov 17, 2008URI iRule Logic
Help!
Attempting to write an iRule that matches multiple uri's. If uri matches it's sent to the appropriate pool, if not but partially right it gets rewritten correctly and sent to appropriate pool, if no matches it gets logged & rejected.
iRule Editor complaining;
line 7: [deprecated usage, use else or elseif] [ ]
---------------------------------------------
when HTTP_REQUEST {
if { [HTTP::uri] equals "/cce-presentation-kiosk-a3/live.html"} {
pool A3-KCI
} elseif
{ [HTTP::uri] ends_with "/cce-presentation-kiosk-a3/" } {
log local0. "URI not complete; rewrittinghttp://[HTTP::host]/[HTTP::uri]"
HTTP::uri "/cce-presentation-kiosk-a3/live.html"} {
pool A3-KCI
elseif { [HTTP::uri] equals "/cce-presentation-kiosk-fv/live.html"} {
pool FV-KCI
} elseif
{ [HTTP::uri] ends_with "/cce-presentation-kiosk-fv/" } {
log local0. "URI not complete; rewrittinghttp://[HTTP::host]/[HTTP::uri]"
HTTP::uri "/cce-presentation-kiosk-fv/live.html" {
pool FV-KCI
} else {
log local0. "URI doesn't match; rejecting connection http://[HTTP::host]/[HTTP::uri]"
reject
}
}
}
}
-------------------
Thanks,
Christopher G Davis
Sr. Network Engineer
SITA Atlanta Data Center
Mobile: +1 404.431.7280
E-mail:Chris_G.Davis@sita.aero
1 Reply
Sort By
- hwidjaja_37598
Altostratus
Try this:when HTTP_REQUEST { if { [HTTP::uri] equals "/cce-presentation-kiosk-a3/live.html"} { pool A3-KCI } elseif { [HTTP::uri] ends_with "/cce-presentation-kiosk-a3/" } { log local0. "URI not complete; rewrittinghttp://[HTTP::host]/[HTTP::uri]" HTTP::uri "/cce-presentation-kiosk-a3/live.html" pool A3-KCI } elseif { [HTTP::uri] equals "/cce-presentation-kiosk-fv/live.html"} { pool FV-KCI } elseif { [HTTP::uri] ends_with "/cce-presentation-kiosk-fv/" } { log local0. "URI not complete; rewrittinghttp://[HTTP::host]/[HTTP::uri]" HTTP::uri "/cce-presentation-kiosk-fv/live.html" pool FV-KCI } else { log local0. "URI doesn't match; rejecting connection http://[HTTP::host]/[HTTP::uri]" reject } }
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