Forum Discussion
Chris_D_15752
Nimbostratus
May 02, 2011Mobile redirect with forced SSL
Hi guys,
I am faced with dual puzzle for site demending dual function redirect causing some issses.
I need to provide detection process from www.main.com site provide mobile type v...
Colin_Walker_12
May 02, 2011Historic F5 Account
So basically, if I understand this correctly, you want to redirect all traffic from 80 -> 443, but with any request coming from a mobile device (as defined by your list of Use-Agents) you want to redirect them to https://m.site.com instead of https://site.com?
If that's correct, then your iRule is pretty close, and you could simply modify it to handle both cases:
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::header User-Agent]] {
"*blackberry*" -
"*windows ce*" -
"*palm*" -
"*sonyericsson*" -
"*lg*" -
"*sie*" -
"*up.b*" -
"*up*" -
"*motorola*" -
"*mot-*" -
"*astel;*" -
"*j-phone*" -
"*netfront*" -
"*xiino*" -
"*iphone*" -
"*benq*" -
"*cricket*" -
"*andr*" -
"*htc*" -
"*nokia*" -
"*portalmmm *" -
"*samsung*" -
"*sec*" -
"*vodafone*" -
"*smartphone*" -
"*symbian*" {
HTTP::redirect "https://msite.web.com[HTTP::uri]"
return
}
}
if { [string tolower [HTTP::header Accept]] contains "vnd.wap.wml" } {
HTTP::redirect "https://msite.web.com[HTTP::uri]"
return
}
if { [HTTP::header exists "MSISDN"] } {
HTTP::redirect "https://msite.web.com[HTTP::uri]"
return
}
if {[TCP::local_port] != 443 }{
HTTP::redirect "https://[HTTP::host][HTTP::uri]
}
Since all of your previous logical statements have built in return statements anyway, this final if should only be executed if nothing else fired, and will do the global redirect everything to SSL functionality, so you would disable this in the profile or wherever you're doing it now and let the iRule handle it. That would, I think, solve the problem.
Colin
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