---
name: azion-create-request-and-response-rules
description: >-
  Rewrite the path an application requests from the origin, and remove a header from the response, with two rules created in Azion Console.
---

# Create request and response rules

[Rules Engine](/en/documentation/platform/applications/rules-engine/) is a feature of [Applications](/en/documentation/platform/applications/) that applies the business rules of your application without code. The reverse-proxy architecture of an application runs each rule in one of two phases. The **Request Phase** carries the data a client sends to an origin server. The **Response Phase** carries the data the origin sends to the client. You create a rule for either phase from Azion Console.

Some Rules Engine variables and behaviors are available only while [Application Accelerator](/en/documentation/platform/applications/#application-accelerator) is on. **Rewrite Request**, used in the first task, is one of them. **Filter Response Header**, used in the second, is not.

---

## Prerequisites

- An application. To create one, refer to [Applications quickstart](/en/documentation/platform/applications/quickstart/).
- Access to Azion Console. Refer to [Access Azion Console](/en/documentation/guides/platform/account-and-billing/how-to-access-azion-console/).
- Application Accelerator on the application, for the request rule only. The module can generate usage-related costs. For the rates, refer to [Pricing](/en/documentation/fundamentals/pricing/#application-accelerator).

---

## Turn on Application Accelerator

The module is off by default, and a rule uses **Rewrite Request** only while the module is on. To turn it on:

1. **Open the application**

   Access [Azion Console](https://console.azion.com/) > **Applications** > **your application**.

2. **Turn on the module**

   On the **Main Settings** tab, in the **Modules** section, turn on **Application Accelerator**.

3. **Select Save**

The application runs with Application Accelerator, and a rule can use **Rewrite Request**.

---

## Rewrite a request path

A rule in the **Request Phase** runs before the request to the origin servers is completed. With **Rewrite Request**, a client receives content from a URI that does not match its path at the origin.

The goal of this task is to deliver the contents of `/content/page.html` when a client requests `https://www.domain.com/page`. To create the rule that rewrites the request:

1. **Go to the Rules Engine tab**

   Access [Azion Console](https://console.azion.com/) > **Applications** > **your application**, then go to the **Rules Engine** tab.

2. **Select + Rule**

3. **Name the rule**

   Enter a name that identifies the rule, and a description if you need one.

4. **Select Request Phase**

5. **Select the variable in the Criteria section**

   In the **Criteria** section, select the `${uri}` variable.

6. **Set the comparison operator**

   Set the comparison operator to *is equal to*.

7. **Enter the argument**

   Enter `/page` as the argument. The criteria identifies the URL of the request by the URI trailing slash `/`.

8. **In the Behaviors section, select Rewrite Request**

9. **Enter the behavior argument**

   Enter `${uri}content/page.html`. The argument concatenates the `${uri}` variable, whose value is `/`, with the path of the page.

10. **Select Save**

A request to `https://www.domain.com/page` returns the contents of `/content/page.html`. The client does not enter the entire address in the browser. A new rule takes a few minutes to propagate.

---

## Remove a header from the response

A rule in the **Response Phase** runs before the response is delivered to the client. With **Filter Response Header**, the rule removes an HTTP header from that response. The behavior does not require Application Accelerator.

A response carries the `Server` header, which holds information about the server that produced it. Removing that header keeps clients from receiving information about the infrastructure of your application. The removal reduces what an attacker can read about that infrastructure.

> **Note**
>
> Exercise caution when you remove a header from your application. Confirm that the removal does not interfere with applicable standards and guidelines.

To filter the `Server` header from the response:

1. **Go to the Rules Engine tab**

   Access [Azion Console](https://console.azion.com/) > **Applications** > **your application**, then go to the **Rules Engine** tab.

2. **Select + Rule**

3. **Name the rule**

   Enter a name that identifies the rule, and a description if you need one.

4. **Select Response Phase**

5. **Select the variable in the Criteria section**

   In the **Criteria** section, select the `${uri}` variable.

6. **Set the comparison operator**

   Set the comparison operator to *starts with*.

7. **Enter the argument**

   Enter `/` as the argument. The criteria runs the rule for the entire application.

8. **In the Behaviors section, select Filter Response Header**

9. **Enter the behavior argument**

   Enter `Server`. The argument removes every instance of the `Server` header from all responses.

10. **Select Save**

Responses from the application no longer carry the `Server` header. A new rule takes a few minutes to propagate.

---

## Next steps

- [Rules Engine](/en/documentation/platform/applications/rules-engine.md): The variables, operators, and behaviors a rule can use in each phase.
- [Application Accelerator settings](/en/documentation/platform/applications/application-accelerator/settings.md): The Rules Engine behaviors the module adds, with the arguments each one takes.
- [Cache variation](/en/documentation/platform/applications/application-accelerator/cache-variation.md): What the module changes in a request, and why some behaviors depend on it.
- [Configure Advanced Cache Key](/en/documentation/guides/application-performance/cache-and-purge/advanced-cache-key.md): Vary a cached object by query string or cookie, then apply it with a rule.
