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.
Picking this up…we are performing the URI rewrite successfully and hitting the backend server, but there response back is getting an error on the client application:
Mapi Comm Base: Error during EndCall(): Destination Unreachable ---> WSE816: The header must match the value of an incoming message’s HTTP Request Url if the soap receiver does not have an actor name. The header received contained “http://aa.mycompany.com/compA/file.asmx” while the HTTP Request Url was “http://aa.mycompany.com/global/file.asmx”.
How can we modify it so that the client is not aware of the change to the URI in the backend?
We will also have a list of 200-300 companies to compare against so help on the best way to set that up is appreciated.
We need to create an iRule with very similar characteristics to the one you describe here… for many companies as well. Was there ever a discussion on the resolution to this effort?
If you comment out the redirect and uncomment out the HTTP::uri command, then LTM will rewrite the URI before the request is sent to the pool. The client will not see the update as they aren’t redirected to a new location.
Issue a HTTP redirect to the client browser
HTTP::redirect $newuri
Modify the URI sent to the backend server
HTTP::uri $newuri
If you try that and run into any issues, let us know.