Hi All,
Could you please comment on the requirement below?
-
HTTP client sends out an HTTP request with POST data and a header, say Header_1
-
Proxy (F5-LTM) should:
a. fetch the value of this Header_1
b. refer to a simple mapping-table (Header_value <--> URL)
c. fetch the URL corresponding to value of Header_1
d. FORWARD* the client to this fetched URL.
(a service at that URL will then return a response to the client as per the POST data in the request)
(subsequent request will be entirely independent and will follow same pattern as per steps 1, 2 above)
*Note: the client is not a regular user-agent/browser and canNOT process HTTP 3xx redirects.
What is a good way to achieve this on the LTM?
Thanks,
Jatin
Hi Jatin,
this sounds like pretty easy and simple URI rewriting. Your POST request is coming in like this:
http(s)://
With an iRule you verify the required header with your mapping (data group list) and then just replace the value of [HTTP::uri] with the one from the DGL. So the client would still see the request going towards , but towards the server “behind” the F5 it will go towards . So there will be NO redirect initiated.
Hope that helps you!
Ciao Stefan 
First, I think you have to configure the virtual Server on Port 80 - no magic here. Second, you can create a datagroup like this:
class header_mapping {
headervalue1 /test
headervalue2 /dev/test2
...
}
Third, You can create an iRule like this:
WHEN_HTTP_REQUEST {
set location [findclass [HTTP::header "header_1"] header_mapping " "]
if { ($location ne "") } {
HTTP::respond 301 Location "http://www.domain.de$location"
return
}
}
See also DevCentral - An F5 Technical Community
Sorry - I did not read your final Note* In your case you should try to manipulate the HTTP Response directly in HTTP_RESPONSE event.
The HTTP response doesn’t need to be manipulated, that’s already too late.
If I understood Jatin correctly, he has one form pointing to the VS, but depending on a header value it needs to be “translated”/forwarded to different URIs towards the servers in the pool. Redirect is not allowed/possible, which would by the way also a little bit tricky with POST-requests.
I would go with a DGL like this:
ltm data-group internal /Common/header_uri_mapping {
records {
header1 {
data /uri1
}
header2 {
data /uri2
}
}
}
And an iRule like this:
WHEN_HTTP_REQUEST {
set new_uri [class match -value [HTTP::header "header1"] equals header_uri_mapping]
if { $new_uri ne "" }{
HTTP::uri $new_uri
}
}
Ciao Stefan 
Thanks ssievers. I appreciate your help.