Forum Discussion
jacob900_39797
Nimbostratus
May 04, 2007multiple url/uri rewrite w/multiple default statements???
I have a group here at work that wants to accomplish the following translations. It is the same vip but the URI is different for each app. I have a http redirect in place for the http-to-https part. T...
JRahm
Admin
May 04, 2007If 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.
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