Forum Discussion
JRahm
May 04, 2007Admin
If you define a class with the appropriate app1, app2, app3, etc values, would this meet your needs:
when HTTP_REQUEST {
set app_path [string tolower [getfield [HTTP::host] "." 0] ]
if { [matchclass $::defined_apps equals $app_path] } {
HTTP::redirect "https://internal_url.abc.com/$app_path[HTTP::uri]"
}
}
I haven't tested this, but it should work like this:
http://app2.abc.com/my_path/internal?userid=citizen_elah
will be redirected to
https://internal_url.abc.com/app2/my_path/internal?userid=citizen_elah
Now if you also want to control pool selection, you could use findclass to extract the pool name associated to the app like so:
when HTTP_REQUEST {
set app_path [string tolower [getfield [HTTP::host] "." 0] ]
if { [matchclass $::defined_apps contains $app_path] } {
HTTP::redirect "https://internal_url.abc.com/$app_path[HTTP::uri]"
} elseif { [string tolower [HTTP::uri]] starts_with "/$app_path"} {
pool [findclass $app_path $::defined_apps " "]
}
}
This assumes a class such as:
"app1 app1-pool"
"app2 app2-pool"
"app3 app3-pool"
Not sure all my ducks are in a row, but perhaps this gives you a springboard to solve your problem.