How to create rules to automate behaviors with Rules Engine
Implementing rules in your application using Rules Engine will allow you to determine the tasks it should execute in specific scenarios without modifying your application’s code.
This guide demonstrates the process of creating rules with a practical example, but most rules will be unique to each application and its needs. In addition to activating variables such as device groups, cache settings, and origins, you can create a wide variety of rules in both the request and response phases.
With this guide, you’ll create a rule in the response phase to remove an HTTP header using the Filter Response Header behavior.
To activate the Application Accelerator module:
- Access Azion Console > Edge Application.
- Click the edge application you want to configure.
- Activate the Application Accelerator module.
- Click the Save button.
The Server
header stores information about the server that generated the response. By removing this header, end-users won’t receive information about the infrastructure of your application, enhancing your security by reducing the information available to potential attackers.
To remove the Server
header:
- Navigate to the Rules Engine tab.
- Click the + Rule button.
- Give your rule a name and, if necessary, a description.
- Select Response Phase.
- In the Criteria section, select the
${uri}
variable. - As a comparison operator, select starts with.
- As an argument, add the value
/
. - In the Behaviors section, select Filter Response Header.
- As an argument, add
Server
. - Click the Save button.
To activate the Application Accelerator module:
- Access Real-Time Manager.
- On the upper-left corner of the page, open the Products menu, represented by three horizontal lines, and select Edge Application.
- Click the edge application you want to configure.
- Activate the Application Accelerator module.
- Click the Save button.
The Server
header stores information about the server that generated the response. By removing this header, end-users won’t receive information about the infrastructure of your application, enhancing your security by reducing the information available to potential attackers.
To remove the Server
header:
- Navigate to the Rules Engine tab.
- Click the Add Rule button.
- On the dropdown menu, select Response Phase.
- Give your rule a name and, if necessary, a description.
- In the Criteria section, select the
${uri}
variable. - As a comparison operator, select starts with.
- As an argument, add the value
/
. - In the Behaviors section, select Filter Response Header.
- As an argument, add
Server
. - Click the Save button.
- Run the following
PATCH
request in your terminal, replacing[TOKEN VALUE]
with your personal token and the<edge_application_id>
variable with your edge application ID to activate the Application Accelerator module:
- You’ll receive a response with the updated value.
- Run the following
POST
request to create a rule in the response phase, replacing<edge_application_id>
with theid
value you received in the previous response:
- You’ll receive the following response:
- Wait a few minutes for the changes to propagate.