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. They want to have a simple url that translates into a specific url/uri combination. That is okay too but they also want a "Default" statement put into effect so that for each app any url/uri combination gets redirected to send the user to the right url/uri path.
Task 1 - convert url into url/uri combination based on what original url is.
http://app1.abc.com > https://internal_url.abc.com/app1
http://app2.abc.com > https://internal_url.abc.com/app2
http://app3.abc.com > https://internal_url.abc.com/app3
Task 2 for each app to have a deafaul statement so that any url/uri-wildcard cobmination takes them to the right path, ie: url/stuff, url/unknown, etc.
http://app1.abc.com/* (anything) > https://internal_url.abc.com/app1
http://app2.abc.com/* (anything) > https://internal_url.abc.com/app2
http://app3.abc.com/* (anything) > https://internal_url.abc.com/app3
With one app, it's workable but I don't understand how to do multiple url to url/uri redirects and multiple "Defaut" statements. I don't see any examples (so far) that are doing this style exactly. Any samples would be highly appreciated.
Sample rule for single app - how to do multiple?????
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::uri]] {
"/app1/*" {
pool app1_80
}
default {
HTTP::redirect http://[HTTP::host]/app1/
}
}
}
- JRahm
Admin
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]" } }
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 " "] } }
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