lnease2_55281
Apr 09, 2012Nimbostratus
Modifying header's host and from HTTP to HTTPS
I have a virtual server that accepts HTTP requests and then sends HTTPS from there to a backend server (that is actually a third party server). It works fine, but because of soap requests, the initiating client request needs to look like it is coming from the F5 instead of from the client when it reaches the web service running on the pool node. We're getting a address mismatch on the backend web service.
So I am trying to write an iRule that will do the following:
Change the request's host name in the header and also change that header to be a HTTPS request instead of a HTTP request. Will the code below work?
NOTE: this is *not* a redirect; I can't send the client to a different URL. So I have to rewrite the header info. And I am thinking I better do this in both directions to avoid problems. Is my code correct below? Please help! Thanks!
when HTTP_REQUEST {
if { [HTTP::host] equals"internal.hostname.com"} {
HTTP::header replace Host "thirdparty.hostname.com"
HTTP::header replace http:// https://
}
}
when HTTP_RESPONSE {
if { [HTTP::host] equals"thirdparty.hostname.com"} {
HTTP::header replace Host "internal.hostname.com"
HTTP::header replace https:// http://
}
}