Forum Discussion
What_Lies_Bene1
Nov 13, 2012Cirrostratus
OK, here's my first attempt. They may be a better way but for now I'm assuming the domain name ends with .com so we can match the start of each URI with .com/. If I just used / it will replace every / in the path and break things. Replace .com with whatever you use.
when HTTP_REQUEST {
STREAM::disable
log local0. "URI = [HTTP::uri]"
switch [string tolower [HTTP::uri]] {
"/devproxy/" {
pool devproxy-pool
set environuri /devproxy/
return
}
"/qaproxy/" {
pool qaproxy-pool
set environuri /qaproxy/
return
}
"/uatproxy/" {
pool uatproxy-pool
set environuri /uatproxy/
return
}
default {
HTTP::respond 200 content "Please use /devproxy to go to the dev-dmz-proxies,
/qaproxy to go to the qa-dmz-proxies,
/uatproxy to go to the uat-dmz-proxies" noserver Content-Type "text/html" Connection Close
}
}
}
when HTTP_RESPONSE {
switch string $environuri {
"/devproxy/" {
STREAM::expression {@.com/@.com/devproxy/@}
STREAM::enable
return
}
"/qaproxy/" {
STREAM::expression {@.com/@.com/qaproxy/@}
STREAM::enable
return
}
"/uatproxy/" {
STREAM::expression {@.com/@.com/uatproxy/@}
STREAM::enable
return
}
}
}