Forum Discussion
Chris_Lappi_164
Jun 14, 2012Nimbostratus
iRule routing to pool with URI trimming
I am trying to direct client requests to a specific pool based on URI information. When the URI contains "/pdf" we would like to send them to pool ABC. This works. What doesnt work is when sending them to this pool I would like to trim the /pdf off the URI. Here is an example:
Prior to trim
http://www.test.com/pdf/new.pdf
Post Trim
http://www.test.com/new.pdf
Below is our iRule. Maybe I am missing something or misunderstanding how it should work but any help would be greatly appreciated.
when HTTP_REQUEST { if {[string tolower [HTTP::host]] eq "www-qa.digi.com"}{ switch -glob [HTTP::uri] { "/pdf/*" { HTTP::uri [string trimleft [HTTP::uri] /pdf] log local0. "Selected Pool:ABC" pool ABC } default { log local0. "Selected Pool:123" pool PL-123 } } } }
- hooleylistCirrostratusHi Chris,
when HTTP_REQUEST { log local0. "[IP::client_addr]:[TCP::client_port]: [HTTP::method] to [virtual name] [HTTP::host][HTTP::uri]" if {[string tolower [HTTP::host]] eq "www-qa.digi.com"}{ switch -glob [HTTP::uri] { "/pdf/*" { HTTP::uri [string range [HTTP::uri] 4 end /pdf] log local0. "[IP::client_addr]:[TCP::client_port]: Selected Pool ABC and trimmed /pdf" pool ABC } default { log local0. "[IP::client_addr]:[TCP::client_port]: Selected Pool:123" pool PL-123 } } } }
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