Device Groups
Device Groups is an Edge Application capability that allows you to identify the devices that will send requests to your application and categorize them into groups. You can use Device Groups to set custom application behaviors and cache policies based on the groups you create. Once you’ve created a device group, you can configure a rule or a cache policy specifically for the devices within the group.
Users that access applications created in Azion Console send Azion data via HTTP request headers. The User-Agent
header stores information on the user’s browser, operating system, version, and manufacturer. This header follows the syntax:
Where:
product
: product identifier.product-version
: version number of the product.comment
: system information, platform name and details, and extensions.
For instance, the following User-Agent
header indicates that a Windows machine has accessed the application using Mozilla Firefox:
Device Groups works by matching the contents of the User-Agent
header to the regular expression you set for the device group.
For example, you can create a device group called Mobile whose regular expression must match the contents within the User-Agent
header that identifies mobile devices. The following expression can be used to identify most of the existing mobile devices:
Implementation
Scope | Resource |
---|---|
Edge Application first steps | First steps |
About Rules Engine | Rules Engine |
About Adaptive Delivery | Adaptive Delivery |
Rules Engine
When you create a rule, you can use the variable ${device_group}
to define which behaviors your application should perform for the device groups you’ve created. To reference a device group, you can add its name to the argument section after you select the desired comparison operator.
To use this variable, you must enable Application Accelerator.
The following criteria identifies whether the user request comes from a device that matches a device group named Mobile:
Variable | Comparison Operator | Argument | |
---|---|---|---|
If | ${device_group} | is equal to | Mobile |
Rules Engine can also identify devices using the ${http_user_agent}
variable directly by adding a string or regular expression as an argument. That way, you can identify specific devices without having to dedicate a device group to them.
The following criteria identifies whether the user request comes from an iPhone device:
Variable | Comparison Operator | Argument | |
---|---|---|---|
If | ${http_user_agent} | matches | (?i)iPhone |
Adaptive Delivery
You can reference an existing device group for Adaptive Delivery. You can choose one or more device groups to apply the same Adaptive Delivery policies.
Learn more about Adaptive DeliveryPrioritization
Device Groups will prioritize matches first-to-last, regardless of the order within the User-Agent
header from the request. Given the following list of device groups:
Device group | Regular expression |
---|---|
Mobile | (Mobile|Android) |
Tablet | (iPad|Android) |
Desktop | (Chrome|Mozilla) |
If the request is made by a device that contains Android Tablet Mobile (Mozilla Firefox)
in its header, the words Android
and Mobile
will match the Mobile group.
However, for a request from iPad Apple Webkit Mobile
, the device will be identified as Mobile owing to the presence of Mobile
within the request, despite iPad
matching the Tablet device group.
When setting up your rules, keep in mind that User-Agent
headers for different devices can sometimes contain the same words. For instance: Google Chrome Android
likely came from a mobile device while Google Chrome Symbian
likely belongs to a desktop; both used the same Google Chrome application to access the application. Make sure to use precise wording when grouping devices.