irule to modify hostname in http request and http response
Hi All,
I have a requirement to modify the hostnames on the LTMs. We have an external app and it's accessed from the Internet. Clinets will use https://xyz.com, but the load balanced servers in internal network are configured for the host name - abc.com. So, we need to modify the hostname from xyz.com to abc.com when the LTM sends traffic to the load balanced servers. Also, we need to modify the hostname from abc.com to xyz.com when LTMs sends the return traffic to the client. I am using the following iRule and I would like to know if it will work
when HTTP_REQUEST {
if { ([string tolower [HTTP::host]] equals "xyz.com") }{
# Replace the host header value with abc.com
HTTP::header replace Host "abc.com"
}
}
when HTTP_RESPONSE {
# Replace the host header value with xyz.com
HTTP::header replace Host "xyz.com"
}
I configured the VIP as a standard VIP and SSL termination (client-ssl and server-ssl) is configured. We installed the certificates for xyz.com on the LTM.
I am also looking at rewrite profiles. Article link - https://techdocs.f5.com/kb/en-us/products/big-ip_ltm/manuals/product/ltm-implementations-13-1-0/15.html#guid-62df4df9-a58f-47b0-90e4-a974cf3cd35f I am not sure if I can implement this using rewrite profile.
Thanks.