Forum Discussion
agidwani_102403
Nimbostratus
Feb 21, 2008Need help
hello,
I need to accomplish the following
rewrite the uri https://aa.mycompany.com/compA/blah.acmx (can have companyA, Company123, CompanyABC etc)
rewrite the uri to htt...
Feb 21, 2008
Here's one option for companies "compA", "compB", and "compC". You can modify/expand this by replacing/adding new company names to the switch statement.
when HTTP_REQUEST {
switch -glob [HTTP::uri] {
"/compA*" -
"/compB*" -
"/compC*" {
set comp variable to first sub dir of in uri.
set comp [getfield [HTTP::uri] "/" 2]
perform a string map from the found string to "global" in the URI.
set newuri [string map [list $comp "global"] [HTTP::uri]]
Issue a HTTP redirect to the client browser
HTTP::redirect $newuri
Modify the URI sent to the backend server
HTTP::uri $newuri
}
}
}You have two options in changing the URI. You can issue a redirect to the client browser with the HTTP::redirect command. Or you can just modify the URI that is sent to the backend server. comment/uncomment the one that you desire.
Now, if you have a large number of company names, you may want to move to a data group/matchclass solution. If that's the case, let me know and I'll work out an iRule for you.
Hope this helps...
-Joe
Recent Discussions
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
