Forum Discussion
Howard_Poz_1055
Nimbostratus
May 19, 2006"String based" Redirect Question -
Hi Folks (i'm still new to iRules). Looking for verification to see if I'm on the right track with this iRule below (think I'm close).
I want uri's containing the text "/ABCHome.aspx?_act=ShowMap" to use the normal port-80 pool. Conversely, I'd like the absence of that string to do a redirect to https. Would you be kind enough to please verify if this iRule looks to be in order ? I'd greatly appreciate it - thank you very much - Howard P.
==============================================================
when HTTP_REQUEST {
if { [HTTP::uri] contains "/ABCHome.aspx?_act=ShowMap" } {
pool HTTP_pool
} else {
HTTP::redirect "https://%5bHTTP::host%5d%5bHTTP::uri%5d"
}
===============================================================
2 Replies
- Martin_MachacekHistoric F5 AccountHoward,
you've posted to a wrong forum (iRules -> v4.x instead of v9.x).
Your rule is almost correct. You are just missing closing right brace for the "when .." clause. I'm assuming that those HTML escapes (%5b, %5d) in the HTTP::redirect command are actually left and righ bracket in your configuration and were just munged while posting to the forum. The correct syntax is:when HTTP_REQUEST { if { [HTTP::uri] contains "/ABCHome.aspx?_act=ShowMap" } { pool HTTP_pool } else { HTTP::redirect "https://[HTTP::host][HTTP::uri]" } }
If you need further help, please post to the iRules -> v9.x forum. - steven_forti_83
Nimbostratus
I would like to do almost the same thing. I would like to redirect several areas of a page based on URI to https while leaving the rest of the pages which do not require ssl as http. I estimate that my web developers will have about 6 URI's which will require http to https redirection. How can I accomplish this?
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
