Redirect based on HTTP_USER_AGENT

0

Hi guys,

I'm new to Kemp and I'm evaluating LoadMaster on Azure. I'm trying to figure out a way to redirect website users based on their user-agent.
let's say my website it example.com.
If your user-agent contains ipad, I want the LoadMaster to redirect you to tablet.example.com.

Thanks.
Ib

2 comments

Avatar
0
Barry Gleeson

Hi,
Yes, you can perform a redirect based on User-Agent String.
User agent Strings can be found here:
http://www.useragentstring.com/pages/useragentstring.php
The first thing to do is create a rule matching the particular traffic (In this case IPad)
In the main menu, select Rules & Checking and Content Rules.
Click Create new.
Use the following Rule.
RuleName: Match_iPad
Rule Type: Content Matching
Match Type: Regular Expression
Header Field: user-agent
Match String: .*IPAD.*
(all other fields can be left default)
There are a number of ways to then perform the redirect.
I would suggest creating two Sub Virtual Services under the same Virtual Service.
(Expand Real Server section - New SubVS)
then you can content switch traffic between the SubVS (i.e traffic matching the Content Rule to Sub VS1 and All other traffic to SubVS2)
Expand the Advanced Properties section.
Enable Content Switching
Then next to each SubVS you will see "none"
For SubVS1
Click None
Add Match_iPad
For SubVS2
Click None
Add default.
Finally to redirect all the traffic going to SUBVS1 to a different URL :
In Advanced Properties, go to Not Available Redirection Handling.
Error Code: 302 Found
Redirect URL: tablet.example.com%s
Barry

Avatar
0
adeptit

Hi Barry,

Thanks for your prompt reply. I have tried user content switching as per your instructions, but that doesn't seem to work either. the requests always go to SubVS2 no matter what the user-agent is.