Redirect / Rewrite iRule
Hi,
I am trying to achieve something quite straight forward with an iRule but struggling to get this to work.
The requirement is this: I want an iRule to both redirect and rewrite the URL at the requesting browser. For example, a request to http://www.new.com should redirect to http://www.old.com/vs, but leave (or re-write) the address as http://www.new.com.
I have looked at Colin Walker’s “Redirects, Rewrites and App Transfers via iRules” article, from which I’ve put together the following:
when HTTP_REQUEST {
set newURI "/vs"
HTTP::uri $newURI
HTTP::header replace "Host" "old.com"
}
when HTTP_RESPONSE {
log local0. "Response: [HTTP::host]"
}
The best I get is the following error from Firefox: The connection to the server was reset while the page was loading.
Interestingly, I never see the HTTP_RESPONSE entry in the LTM log.
Using the HTTP::redirect command gives what I’m after as far as redirection is concerned, but places the redirected to URL in the browser address bar.
So, what I’m after is an iRule to redirect but also allow me to manipulate the URL as seen at the browser.
Any help appreciated.
Mark.
Ps: Relatively new to F5s; really new to iRules!