Forum Discussion
iRule Redirect Mobile Site
I have this iRule to identify mobile browser, for example apple devices:
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] contains "www.mainsite.com" } {
switch -glob [string tolower [HTTP::header User-Agent]] {
"*iphone*" -
"*ipod*" -
"*ipad*" {
HTTP::redirect "http://mobilesite.com[HTTP::uri]"
return
}
}
}
}
mobilesite.com has a link to www.mainsite.com (In case you don´t like be in mobile site)
I want to do something that manage if you are in mobile site and you want to go to main site the iRule does not enter in a loop.
Any ideas??
Jorge.
17 Replies
- hoolio
Cirrostratus
Hi Jorge,
See this thread for a recent discussion on this. If you still have questions feel free to reply here or there with details.
http://devcentral.f5.com/Community/GroupDetails/tabid/1082223/asg/50/aft/1178780/showtab/groupforums/Default.aspx
Aaron - OCC_68606
Nimbostratus
Thanks Hoolio, let me check the information.Regards.
Jorge
- OCC_68606
Nimbostratus
Hi, I need to have the option to redirect to full site in my m.site.com, but a don´t have any idea to do that, I have the main site in a different pool than mobile one. Could anyone give me some information to get documentation to do this configuration?
Escenario.
From a mobile device enter to full.site.com --> user agent detection redirecto to m.site.com --> if I prefer to go to full.site.com I don´t want to enter in a loop.
Regards.
JVM
- nitass
Employee
doesn't the cookie which Aaron suggested in the past discussion topic work? - OCC_68606
Nimbostratus
Hi Have problems to detect cookie from full and mobile site. Do you have any script?Thanks.
JVM
- OCC_68606
Nimbostratus
As a comment I have the main site and the mobile site in different virtual servers, pools, etc. for me are two different applications. How can I manage the iRule, by cookie or by referer??
Regards.
JVM
- nitass
Employee
Have problems to detect cookie from full and mobile site. Do you have any script?sorry i do not have.
I have the main site and the mobile site in different virtual servers, pools, etc. for me are two different applications. How can I manage the iRule, by cookie or by referer??they are in same 2nd level domain, aren't they? so, i think cookie could be fine. - Ashish_Ram_Tak1
Nimbostratus
Dear All,
We are banking customer and we have decided to create mobile user login for our Internet customers, below is the senireo
1) Initially we have www.example.in in public DNS now when this request comes to our LTM it will redirect to home.example.co.in, now when any mobile user type www.example.in in his mobile browser he will go to home.example.co.in i have assigned an iRule to the VS of home.example.co.in to redirect that traffic to lite.example.co.in and its working fine if the user is mobile user based on his OS other desktop and laptop users will straight away go to home .example.co.in.
2) Now in another case we have given one link in a webpage of lite.example.co.in IF YOU WANT TO GO TO MAIN SITE PLEASE CLICK HERE, when user click on this link (is main==true) query string will be passed and that particular mobile user will have to move to home.example.co.in.
But unfortunately we still haven't fined any solution for this, could you please help me on the 2nd case.
Below is the iRule which we are using for mobile user redirection.
When HTTP_REQUEST {
if{ [string tolower [HTTP::header “User-Agent”]] contains “*iPhone” } {
HTTP::redirect "https://lite.example.co.in"}
}
Could you please help me on this its an very important and high priority case, thank you in advance for your support.
Regards,
Ashish Takawale - nitass
Employee
is this helpful?
Mobile Device Detection with logic
https://devcentral.f5.com/community/group/aft/2160890/asg/50 - Ashish_Ram_Tak1
Nimbostratus
Dear Nitass,
The below link is helpfull, but i dont want to redirect por particural uri's just want to redirct if user clik on link then redirect that to main site. If possible could you please help me with iRule.
Regards,
Ashish
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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
