redirect based on browser user-agent
search cancel

redirect based on browser user-agent

book

Article ID: 236731

calendar_today

Updated On:

Products

CA API Gateway

Issue/Introduction

I am trying to send back a redirect (302) based on the browser user-agent.

I want to send the redirect if the user-agent is MSIE or rv:11.0

The "if" logic below is not correct.

See screen shot....

Environment

Release : 10.0

Component : API GATEWAY

Resolution

In the policy the route should be the last assertion in the “All assertions must be true”  - remove the stop process 

Approach to route based on browser accesses 

Set Context Variable “browser”   sting:  ${request.http.header.user-agent}

Example for IE 10

browser = {String} "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 10.0; WOW64; Trident/7.0; Touch; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729; Tablet PC 2.0; wbx 1.0.0; wbxapp 1.0.0; Zoom 3.6.0)" 

“At least one assertions must be true”

All assertions must be true

Compre variable ${browser} data type:  String, If Multivalued: “any value must pass”

Rules: Add simple comparison Rule for ${browser}

Right Expression:  Mozilla/4.0

NOTE You could also use MSIE 7.0

The last branch catch all should have continue

Example: