Forum Discussion
lnease2_55281
Nimbostratus
14 years agoModifying 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://
}
}
2 Replies
No RepliesBe the first to reply
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