Forum Discussion
reldar_76465
Jul 13, 2011Nimbostratus
redirect mobile devices
Hi,
I'm looking for a script that will enable us to redirect all traffic coming from mobile devices to a mobile site.
Many thanks for the help.
Roy
Michael_Yates
Jul 19, 2011Nimbostratus
Hi reldar,
As you can see in the link that Hoolio posted, there are quite a few User-Agents (and more are being added with each release of a new Web-Mobile capable device), so you are going to have to maintain a list one way or the other.
The list of non-mobile browser User-Agents (which is probably far more manageable) or a list of mobile User-Agents in order to fully tackle what you are trying.
I would suggest changing your iRule on the mobile Virtual Server to capture the non-mobile browser agents and redirect them to your non-mobile site and on your non-mobile site reverse the logic and say if you are not a non-mobile browser redirect to the mobile site. Then you should only have to keep track of one set of User-Agents.
You could also put a default action to log any unknown User-Agents when you want to see what the site is actually processing (and comment it out when not needed):
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::header User-Agent]] {
"*blackberry*" -
"*ipad*" - {
log local0. "Device Access Attempt [HTTP::header User-Agent]"
HTTP::redirect "http://m.mysite.com/[HTTP::uri]"
return
}
}
}
(It is also worth noting that if people find out how you are filtering their traffic, it is possible to change the User-Agent of most devices to get around this type of filter).
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