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...
hoolio
Cirrostratus
Feb 08, 2010Hi Joe,
That looks good. With TCL, you need to escape hyphens in variable names with curly braces: ${requested-uri}. It's easier to use an underscore instead.
Here is an updated version you can try:
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::uri]] {
/uri1* -
/uri2* {
set check_response 0
snatpool SNAT_DMZ
pool pool_www.mysite.org_URI1
}
/testlink* {
snatpool SNAT_APZ
set check_response 1
pool pool_www.mysite.org_TESTLINK
}
}
}
when HTTP_RESPONSE {
if {$check_response} {
STREAM::expression "@http://www.mysite.org@https://www.mysite.org@"
STREAM::enable
} else {
STREAM::disable
}
}
Aaron
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
