Forum Discussion
ronniep_79067
Nimbostratus
Nov 13, 2009Help: Force to use DNS name
I have been looking for a while, but cannot locate any information. Is there a way one can use and irule to force a user to use dns as apposed to an IP address to connect to a server? Any help would be appreciated.
Thanks!
- ronniep_79067
Nimbostratus
I am currently using version 9. - hoolio
Cirrostratus
Hi Ronnie,when HTTP_REQUEST { Check if host header value contains at least one alpha character if { not ([ string match -nocase "*\[a-z\]*" [HTTP::host] ])}{ Redirect client to the correct hostname, preserving the original URI HTTP::redirect "http://www.example.com[HTTP::uri] } }
- ronniep_79067
Nimbostratus
Thanks for your help, it will work for DNS requests as described. I guess I didn't explain very well. - hoolio
Cirrostratus
If you want to redirect a client that requests www.example.com to example.com, you could use an iRule like this:when HTTP_REQUEST { Check requested hostname (set to lower case) if {[string tolower [HTTP::host]] eq "www.example.com"}{ Redirect client to example.com with the same URI HTTP::redirect "http://example.com[HTTP::uri] } }
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