Forum Discussion
WillC_97839
Nimbostratus
Dec 14, 2009Redirect irule puts in query twice
Hi there,
I've got a basic irule so when someone hits my admin vhost, it will always go over https. The current rule is:
when HTTP_REQUEST {
set myURI [string tolower [HTTP::uri]]
set myQUERY [ string tolower [HTTP::query]]
if { [HTTP::host] eq "admin.mysite.com"} {
HTTP::redirect "https://admin.mysite.com[HTTP::uri][HTTP::query]"
}
}
It works fine for pages like:
http://admin.mysite.com/articles/myarticle.php
http://admin.mysite.com/articles/myarticle.php?action=view&productionarticle_id=10080
But I'm having a problem with:
http://admin.mysite.com/charts/?selected=edit
It redirects to:
https://admin.mysite.com/charts/?selected=editselected=edit
so, it seems like it's not parsing out the variables following the /.
Here's a log entry of what it thought it saw:
The HTTP URI: /charts/?selected=edit -- the HTTP query: selected=edit
Any suggestions on how to get it working?
Thanks
- hoolio
Cirrostratus
Are you just wanting to redirect with the full URI preserved? In F5 terms, the host is the host header value, the URI is everything after the host which includes the path and the query string. The query string is everything in the URI after the question mark:when HTTP_REQUEST { Check if host, set to lower case, is admin.mysite.com if { [string tolower [HTTP::host]] eq "admin.mysite.com"} { Redirect client to same host and URI via https HTTP::redirect "https://admin.mysite.com[HTTP::uri]" } }
- WillC_97839
Nimbostratus
Ah got it. I got confused. I just need to preserve the URI and not necessarily the query.
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