Forum Discussion
Oxenburger_1420
Nimbostratus
Jan 30, 2014Create iRule to change URI Path to parse last directory
Hi,
I'm trying to create an iRule that matches URI starting with “eat9.raspberry.cheesecake.com/cache/_/(_)” to resolves to “eat9.raspberry.cheesecake.com/(*)” via the F5
i.e. “eat9.raspberry.che...
Oxenburger_1420
Nimbostratus
Jan 30, 2014Hi,
I've rewritten the rule using switch -glob as suggested. Not sure if this works yet but will test soon. With /cache/ I'm trying parse the last directory and everything after that. e.g. “eat9.raspberry.pies.com/cache/1.1.201311042258/js/jquery.js” is changed to “eat9.raspberry.pies.com/js/jquery.js” but doesn't seem to be working.
I get error item not found.
elseif { [HTTP::host] eq "eat9.raspberry.pies.com" } {
switch -glob [HTTP::uri] {
"/fonts/" -
"/css/" -
"/templates/" -
"/js/" -
"/images/" -
"/pages/" { pool PL_eat9.raspberry.pies.com_1444
}
"/cache/" {
set depth [URI::path [HTTP::uri] depth]
set last_dir [URI::path [HTTP::uri] $depth $depth]
set last_string [string trimleft [string range $last_dir [expr {[string last / $last_dir]}] end] -/]
[HTTP::uri] "$last_dir$last_string" { pool PL_eat9.raspberry.pies.com_1444
}
}
}
Thanks
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