Forum Discussion
Mike_Graston_10
Nimbostratus
Jul 13, 2007Simple Base URl rewrite
OK I have been looking at this forum and I know it's here somewhere but can't find it. My issue is I have a proxy server sitting in front of a web site http:///abc.com. I need to rewrite the url going...
Jul 13, 2007
You are on the right track with retrieving the value with HTTP::host but you are just updating a local variable, not the actual host header that is sent. This should work for you.
when HTTP_REQUEST {
if { [HTTP::host] eq "abc.com" } {
HTTP::header replace "Host" "def.com"
}
}
That's it. There is nothing needed to be done on the return trip to the browser because the browser still thinks it's accessing http://abc.com. That, along with the fact that the URI isn't part of the HTTP response so even if you wanted to, you couldn't inform the browser of the backend switch. The only way to make a browsers address bar change to an updated URI (ie, if you wanted it to display http://def.com) is to issue a HTTP redirect causing the browser to reissue a new request to the updated address.
-Joe
Recent Discussions
Related Content
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