Forum Discussion
Moe_Jartin
Cirrus
Feb 08, 2010Conditional stream rewrite based on requested uri
I want to rewrite some content based on the uri that is requested. I started with:
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::uri]] {
/uri1* -
/uri2* {
sna...
Moe_Jartin
Cirrus
Feb 08, 2010Aaron,
Thanks again for your help! In your updated rule you used "set check_response 0" and "set check_response 1". This works if there are only two cases. I had actually truncated my irule a bit and there are actually several switch cases. I suppose I could just set check_response to 1 for each uri I wanted to use the stream expression for? Assuming I wanted to use the same stream expression for all match cases.
What if I wanted to use a different stream expression for each uri? Could I set check_response to 1, 2, 3, respectively, and then do a
switch $check_response {
1 {
STREAM::expression "@http://host1@https://host1@"
STREAM::enable
}
2 {
STREAM::expression "@http://host2@https://host2@"
STREAM::enable
}
3 {
STREAM::expression "@http://host3@https://host3@"
STREAM::enable
} default {
STREAM::disable
}
}
Also, rather than use 1, 2, 3, I could use something more intuitive that matches the path like uri1, uri2, uri3. This doesn't necessarily apply to this scenario but I have needed/wanted to do this type of thing before and just didn't know how.
Thanks,
Joe
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