Forum Discussion
irule to modify hostname in http request and http response
The irule will work correctly for requests - the Host header will be changed correctly.
However, you do not need to modify a host header in a response, as Host is a request header and not a response header. What you do need to do is modify any references within the response to correct the host (for example, the Location header in a HTTP 302 Redirect response may contain the hostname). Cookies may also contain a domain attribute that needs to be corrected to ensure that the client returns the cookies appropriately.
So using the Rewrite profile is a better approach - otherwise you will probably need to us a STREAM irule to carry out textual substitution of the domain names, which the rewrite profile automates.
Thanks Blakely. I will try using the rewrite profile. So, can I still use the iRule for requests and use the rewrite profile for responses. Or do you recommend using rewrite profile for both requests and responses. Thanks again.