Forum Discussion
hassan_35513
Nimbostratus
Oct 15, 2008Rewrite IP to Host name
I have client connecting to 1.1.1.1 and I want to rewrite their request to www.mydomain.com. I also have clients going directly to www.mydomain.com.
What is the best way to doing it.
- hoolio
Cirrostratus
You can redirect to the www.mydomain.com domain if the requested host header isn't www.domain.com:when HTTP_REQUEST { Check if requested host is noto www.mydomain.com if {not ([string tolower [HTTP::host]] eq "www.mydomain.com")}{ Redirect client to www.mydomain.com HTTP::redirect "http://www.mydomain.com" } }
- hassan_35513
Nimbostratus
Aaron, Thanks for the quick respone. I don't really want to redirect the client as they are natting my ip on their side. I want to rewrite it - hoolio
Cirrostratus
I'm not sure whether it would be more efficient to rewrite all host headers to www.mydomain.com or check if the host header isn't www.mydomain.com and then rewrite it. Here is an example of the latter:when HTTP_REQUEST { Check if requested host is not www.mydomain.com if {not ([string tolower [HTTP::host]] eq "www.mydomain.com")}{ Rewrite host to www.mydomain.com HTTP::header replace Host "www.mydomain.com" } }
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