Forum Discussion
donmunyak_10415
Nimbostratus
Jul 24, 2009Rewrite & Redirect user login
v9.4.3 iRule
Testing for
to be rewritten and/OR redirected to:
The initial URL is allowed because DNS has a wildcard 'A' record entry.
The Application team wants us to take the URL from the initial client GET request, and
append to rewritten URL, as the user id.
I know its poor planning, but the application team sees no reason to expect
an https initial GET request.
save initial GET host header
set data [HTTP::host]
when HTTP_REQUEST {
Check for http://fname.lname.mycompany.com and redirect with id="fname.lname.mycompany.com"
if {[HTTP::host] string match {/[a-zA-Z0-9]*\.?[a-zA-Z0-9]*\."mycompany.com"}} {
HTTP::redirect "https://application.store.com/app/jsp/initialGMCLanding.jsp?id=[HTTP::host]"
}
Check for wildcard http://*.mycapitalone.com and redirect with "NO" id.
if {[HTTP::host] string match {/*\."mycompany.com"}} {
HTTP::redirect "https://application.store.com/app/jsp/initialGMCLanding.jsp"
}
}
}
- hoolio
Cirrostratus
Hi,when HTTP_REQUEST { Check if host header matches pattern, a.b.example.com if {[scan [string tolower [HTTP::host]] {%[a-z0-9].%[a-z0-9].example.com} a b] == 2}{ log local0. "[IP::client_addr]:[TCP::client_port]: Matched host [HTTP::host] with $a $b" HTTP::redirect "https://application.store.com/app/jsp/initialGMCLanding.jsp?id=[HTTP::host]" } elseif {[string match -nocase {[a-z0-9]*.example.com} [HTTP::host]]}{ Redirect to default location HTTP::redirect "https://application.store.com/app/jsp/initialGMCLanding.jsp" } else { Take some default action? } }
- donmunyak_10415
Nimbostratus
Thank you very much. I do appreciate the feedback. - F5_LB_Eng
Cirrostratus
Hil,
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