Forum Discussion
Billy_chuang_16
Jun 25, 2008Historic F5 Account
how do I parse a URI value into a variable
Hi,
I would like to "switch" features base on the URI startwith to switch to a defined procedure.
The probem I head is [HTTP::URI] return the whole URL value which is a various length, but I only want to switch base on the first "/xxx/" . How do I use iRule to process this action like following:
Parse "/abc/cde/xyz.jpg" and get the first path value into a Variable to achieve $firstpath == "/abc" .
so that I can use "switch" function to do follow:
switch [string tolower $firstpath ] {
/abc { pool www }
/cde {
HTTP::header insert Header1 domain2
HTTP::header replace Host www.domain.com
HTTP::uri "/domain2[HTTP::uri]"
pool www
}
default { discard }
}
Thanks.
Billy
- Robert_Sutcliff
Nimbostratus
Hi, - Billy_chuang_16Historic F5 Accountthx Rob.
- Deb_Allen_18Historic F5 AccountSpot on Rob, thanks for responding.
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