Forum Discussion
dexter_22020
Nimbostratus
Apr 09, 2009url rewrite with class
Hi,
Newbie on irules here, need help.
class file contains:
/test http://domain.com/main.html
/foo http://domain.com/foo.html
...
...
and so on..
I need an irule that will rewrite anything that starts with /test, /foo, etc.. (left column) to what's equivalent on the right column.
I tried this but I have no idea what's next...
when HTTP_REQUEST {
if { [matchclass [string tolower [HTTP::uri]] starts_with $::test_class] {don't know}
}
Thanks for any info.
- The_Bhattman
Nimbostratus
Rewrite as in rewrite all http data that contains /test in a page? - dexter_22020
Nimbostratus
yes, so anything that starts with the pattern on the left column of the data group will be rewritten to the corresponding right column. - The_Bhattman
Nimbostratus
- dexter_22020
Nimbostratus
hmm.. i'll try that. thanks. - dennypayne
Employee
I think he's more looking for the findclass functionality Click here. Stream profile could only take care of one of these at a time. - dexter_22020
Nimbostratus
yeah but findclass doesn't include the operator starts_with. - Colin_Walker_12Historic F5 AccountYou don't need the starts_with operator inside findclass to make this work. Just populate the class like this:
when HTTP_REQUEST { Grab the portion of the URI after the first / and before the second / set part [getfield [string tolower [HTTP::uri]] "/" 2] set newURI [findclass $part $::yourClass " "] if { $newURI ne "" } { HTTP::uri $newURI } }
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