Forum Discussion
gerald_wegener_
Nimbostratus
Jun 12, 2006Eliminate redirects
In lieu of doing http redirects in the following example basic example:
--------
Client connects to http://abc.com and is redirected to http://www.abc.com
--------
...
Colin_Walker_12
Jun 16, 2006Historic F5 Account
All you'd need to do is re-write the hostname when the client is making a request to the server. The server would then return a Location that includes that modified hostname, and subsequent requests should be sent to the address in the Location header.
So all you should really need to do for this particular scenario is:
when HTTP_REQUEST {
if { not ( [HTTP::host] starts_with "www." ) } {
HTTP::header replace Host "www.[HTTP::host]"
}
}Since you want the client to see the updated URL, you shouldn't have to do any further work. The Location header sent back from the server should include the www, and the client should update appropriately. If you wanted to hide the re-write from the client, that's where more work on the response side of things would come in.
Colin
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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