Forum Discussion
johns
Employee
Jul 28, 2005Using URI to rewrite host
I am trying to come up with a rule where the first directory name of the uri is used to rewrite the URL. an example will be:
http://www.foo.com/abc/doc/index.html =>
http://abc.foo.com...
johns
Employee
Aug 02, 2005I am able to get the following to work:
when HTTP_REQUEST {
set my_uri [getfield [HTTP::uri] "/" 2]
set client_host [HTTP::host]
set new_host $my_uri.$client_host
HTTP::header replace HOST $new_host
log local0. $new_host
log local0. $my_uri
}
However, only when user puts trailing slash at the end. If not, then the server redirects with the modified URI, which does not resolve from the outside and fails. Can you help me figure out a way to add "/" if it is missing from the original request? Thanks.
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