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 version/release services.
I establised individual VIP exposed and registered externally with m.main.com. Requests sourcing from mobile devices are detected and redirected to m.version VIP using script I enclosed below. It works well and relatively all devices are detected and rediected properly. All are happy and I still have the job. Problem develops with adding SSL force redirect after mobile deterction takes place. Standard http_https_redirect fails to complete after my first script runs.
Concept is relatively simple. All traffic to standard VIP is redirected to SSL. Same applies to mobile frame devices and they all need to be SSL forced.
Can you please share some light on single or dual step scripts you know work with this requirements?
I appreciate your help .
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 "]"
return
}
}
if { [string tolower [HTTP::header Accept]] contains "vnd.wap.wml" } {
HTTP::redirect "]"
return
}
if { [HTTP::header exists "MSISDN"] } {
HTTP::redirect "]"
return
}
28 Replies
- Chris_D_15752
Nimbostratus
Hi guys,
It is never over until it is over.... LOL
Can I ask for little bit more of your opionion on returned requests from mobile site ?
I am facing additional puzzle and dev team finds me pretty quick. Customer now wants to redirect back from mobile vips back to native web site since visitors may want to use full version site.
So when a mobile user goes for full site version vip, script detects the device by user's agent. (that works well). then
figures out that his screen is capable of displaying more and manually chooses full site button/link on mobile site home page.
Device hits the full site and now gets to be redected and redirected again putting him back on mobile site. Now they fire my ass.... (just kidding)
I wander if there is a way to place additional variable or statement into begining of the script used above to practically bypass redirection decision if the client's device already visited the mobile site.
If I use uri for detecting m site as referer condition I will probably face issues of continuation of other screens since they will not contain referer string any longer.
What you recommend I use for such control and how is this coded ?
Thanks again -
Chris - Chris_D_15752
Nimbostratus
Guys -
Can you help with any suggestions, please ? - hoolio
Cirrostratus
How does a mobile user opt out of the mobile site? Is there a specific URL they can access? Can you have the mobile site set a cookie if they opt out? Or could you use an iRule to set a cookie if they opt to use the full site? If so, you could put a check for the cookie first in the full to mobile site redirect rule and just exit the event if it's there.
Aaron - Chris_D_15752
Nimbostratus
Thanks for your help Aaron,
We have flexibilty here around building what is considered a requirement. Dev team can certainly help.
As all traffic terminates on main site vip and present irule listed below detects user agent, mobi devices are detected it get redirected to mobile vip. Once they land on mobile vip they get forced into SSL. If user wants to get back to full site based on display capabilities or preference, they select redirect link/button placed on mobile site. Very manual process we can say. We basically can code anything we need on that link or opt button.
Now it is url.
I was wondering if sensing on that string for instance may help sticking the user's device to the main site vip. Then, how do we stop the process of redirection mechanism which is already part of the script. That would be probably working cool on the initial return of the device from a mobile site but I would this will work with every other request sourcing from that same mobi device? That usefull uri or cookie is not presented any longer with repeated requests and if so condition exists than irule would probably fail to retain that session and redirect again causing the loop effect. I am guessing here mostly. It would probably have to be initial check for parameter being used to prevent redirect of mobi devices onto mobile vip/site. I was wandering if there is a way of allowing the device detection to get redirected to mobil site vip only once for simplicity.
For additional simplicity I would recommend to customer to add simple link/button on main web page to choose manual redirection. Just wondering. Cookie sounds good I guess and it can be added to opt out button too. What would be a method you apply in such case and how do you add it to existing irule to take action before the detection of user-agent begins?
Your thougths are really appreciated.
Chris, - hoolio
Cirrostratus
You could add a check for the application set cookie at the top of the iRule using something like this:when HTTP_REQUEST { Check if the full site cookie preference has already been set if {[HTTP::cookie value "full_site_cookie"] eq "some_value"}{ Exit this event in this iRule to avoid a possible redirect to the mobile site return } ... rest of the iRule logic to check for mobile user-agents and redirect them to the mobile site }
The cookie could also be set by an iRule on the mobile site assuming you can detect when a user has selected a preference within the web app to go back to the full site.
Aaron - Chris_D_15752
Nimbostratus
Aaron,
This is a great help. Thank you.
I will talk to dev team and see what they want to do.
I am thinking how this is all going to behave in SSL stream
Thanks
Chris - hoolio
Cirrostratus
Hi Rafael,
Are you able to change the application to set a cookie when a user opts for the full version of the site? If so, you should be able to use an iRule like the one I posted above.
If the app can't be changed, are there specific URIs the client accesses when opting for the full version of the site? If so, you could modify the iRule to set the cookie.
Aaron - Rafael_Lombardi
Nimbostratus
Hi Aaron,
Thank You!! I already asked for the guys form application if they can set a cookie for the full version.
I really appreciate your help!!
Rafael Lombardi - Rafael_Lombardi
Nimbostratus
Aaron,
Is it possible to do another way without cookies? I mean if we have any url after host send to classic full web site otherwise check for user agent and then if it is mobile send to mobile site? - Rafael_Lombardi
Nimbostratus
Aaron,
Is it possible to do another way without cookies? I mean if we have any url after host send to classic full web site otherwise check for user agent and then if it is mobile send to mobile site?
Tks
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
