Forum Discussion
sundogbrew
Apr 23, 2013Altocumulus
Steve, you SO ROCK!!! Thank you so much for your help!
I had to change the 5 back to a 4 once I added the 1. It also works with or without the / in "" I will investigate that more.
the only strange thing I am seeing now is this line
Tue Apr 23 15:58:24 EDT 2013 info tmm tmm[8659] Rule /Common/log-test : chucktest.test.com:8082:8082
not sure why the port is showing up twice or if it matters? It works and that is what REALLY matters!!!!
Here is the final code if anyone wants to use it
when HTTP_REQUEST {
set newuri [findstr [HTTP::uri] "/" 5]
log local0. "Original request is: [HTTP::host][HTTP::uri]"
log local0. "New URI is: $newuri"
set newport [findstr [HTTP::uri] "/" 1 4]
HTTP::uri "$newuri"
log local0. "New Port is: $newport"
HTTP::header replace Host "[HTTP::host]:$newport"
if { $newport ne "" } {
Use the relevant Pool
pool chuckpool_$newport }
else {
log local0. "Newport Variable was empty"
}
}
I set this up with pools named chuckpool_8080, chuckpool_8081... and then I tell the developers to just use the port they want in the URI as in newapp.test.com/8080/app/and/more/crap the script pulls out the port and sends it to the pool chuckpool_8080 (or whatever they choose) and I just use one of the pools as the default. It puts the URI back on and you get to the pool you want with the URI intact.
Thank you again SO MUCH!
Joe