Forum Discussion
paul_dcc
Nimbostratus
Jul 16, 2010HTTP Redirect
Hi All,
I created a simple Irule to do a redirect, but when I test this it takes me to the wrong page beacause it add a / to the end of the url string which I do not require,
Could some one please help with my problem
Thanks
Paul
when HTTP_REQUEST {
Check host header value
if {[string tolower [HTTP::host]] eq "des.dorsetcc.local"}{
Redirect client to the full host name
HTTP::redirect "]"
}
}
3 Replies
- Chris_Miller
Altostratus
What exactly are you trying to redirect users to? Since you're putting [HTTP::uri] at the end of the iRule, it's going to insert the "/" because that's the URI they're specifying.
If you go to, www.google.com for instance, your browser will likely look for the uri "/" at host "www.google.com".
In your case, "/" is the URI, hence why it's being appended. - paul_dcc
Nimbostratus
Cheers Chris,
I'm a network engineer and was not sure what that was there for any way, but it works fine now.
Thanks
PAul. - hoolio
Cirrostratus
Hi Paul,
If the clients could be sending a request to the original hostname with a full query string, you should consider URL encoding the original URI before appending it to the new URI using the URI::encode command. See this post for more info:
URI::encode question
http://devcentral.f5.com/Forums/tabid/1082223/asg/50/showtab/groupforums/aff/5/aft/61577/afv/topic/Default.aspx61591
URI::encode wiki page
http://devcentral.f5.com/wiki/default.aspx/iRules/uri__encode
Aaron
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
