# Application Accelerator settings

[Application Accelerator](/en/documentation/platform/applications/#application-accelerator) is a module of [Applications](/en/documentation/platform/applications/), turned on for one application at a time. The module unlocks the cache fields that vary the cache key, the caching of `POST` and `OPTIONS` responses, and seven [Rules Engine](/en/documentation/platform/applications/rules-engine/) behaviors. This page carries the name, the type, and the default of each field, and the interface that sets it.

---

## Module activation

The module is off by default, and every interface below sets the same toggle. The toggle belongs to the application, not to a cache setting, so one application can carry it while another does not.

| Interface                                                            | Where you set it                                                       | Field or flag                             |
| -------------------------------------------------------------------- | ---------------------------------------------------------------------- | ----------------------------------------- |
| Azion Console                                                        | The **Modules** section of the **Main Settings** tab of an application | The **Application Accelerator** switch    |
| Azion API v4                                                         | `PATCH /workspace/applications/{id}`                                   | `modules.application_accelerator.enabled` |
| [Azion CLI](/en/documentation/devtools/cli/)                         | `azion update application`                                             | `--application-accelerator`               |
| [`azion.config.js`](/en/documentation/devtools/cli/azion-config-js/) | The `AzionApplication` object                                          | `applicationAcceleratorEnabled`           |
| [Azion Lib](/en/documentation/devtools/azion-lib/application/)       | The data passed to an application create or update                     | `application_acceleration`                |

`modules.application_accelerator.enabled` is a boolean and defaults to `false`. `applicationAcceleratorEnabled` and `application_acceleration` are booleans, and the Azion CLI flag takes a string.

The [Azion Terraform provider](/en/documentation/devtools/terraform/) manages the application resource that carries the module. Turning on a module can generate usage-related costs. For more information, refer to [Pricing](/en/documentation/fundamentals/pricing/#application-accelerator).

---

## Cache variation

Application Accelerator adds the `modules.application_accelerator` object to a cache setting, and the fields in it configure **Advanced Cache Key**. They decide which parts of a request, beyond the URL, produce a separate cached object. In Azion Console, the same fields sit in the **Application Accelerator** section of a cache setting. A variation appends the `@@` separator to the cache key. For the format of a cache key, refer to [Cache key format](/en/documentation/platform/applications/cache/cache-keys/#key-format).

| Field                                    | Type                                               | Default  | Console control                                       | What it sets                                                        |
| ---------------------------------------- | -------------------------------------------------- | -------- | ----------------------------------------------------- | ------------------------------------------------------------------- |
| `cache_vary_by_method`                   | array of enum, at most 2 values: `options`, `post` | `[]`     | **Cache vary by Method**, one checkbox per method     | The request methods whose responses are cached.                     |
| `cache_vary_by_querystring.behavior`     | enum: `ignore`, `all`, `allowlist`, `denylist`     | `ignore` | **Cache vary by Query String** > **Behavior**         | The mode that decides how the query string varies the key.          |
| `cache_vary_by_querystring.fields`       | array of string                                    | `[]`     | The field list under **Cache vary by Query String**   | The query string arguments the mode applies to.                     |
| `cache_vary_by_querystring.sort_enabled` | boolean                                            | `false`  | **Cache vary by Query String** > **Sort**             | Whether the variations group under one key, ordered alphabetically. |
| `cache_vary_by_cookies.behavior`         | enum: `ignore`, `all`, `allowlist`, `denylist`     | `ignore` | **Cache vary by Cookies** > **Behavior**              | The mode that decides how cookies vary the key.                     |
| `cache_vary_by_cookies.cookie_names`     | array of string                                    | `[]`     | The cookie list under **Cache vary by Cookies**       | The cookies the mode applies to.                                    |
| `cache_vary_by_devices.behavior`         | enum: `ignore`, `allowlist`                        | `ignore` | **Cache vary by Devices** > **Behavior**              | The mode that decides how device groups vary the key.               |
| `cache_vary_by_devices.device_group`     | array of integer                                   | `[]`     | The device group list under **Cache vary by Devices** | The device groups the mode applies to.                              |

Each **Behavior** dropdown renders the values of its enum title-cased: *Allowlist*, *Denylist*, *Ignore*, and *All*.

One field on the same cache setting sits outside that object and is still gated by the module:

| Field                   | Type                               | Default | Console control         | What it sets                                                               |
| ----------------------- | ---------------------------------- | ------- | ----------------------- | -------------------------------------------------------------------------- |
| `modules.cache.max_age` | integer, `0` to `31536000` seconds | `60`    | **Cache** > **Max Age** | How long the cache holds the object. A value below 60 requires the module. |

For the ceilings that bound a cache setting, refer to [Limits](/en/documentation/platform/applications/limits/#application-accelerator).

---

## Cache setting flags in Azion CLI

`azion create cache-setting` writes the same fields from the command line. Each flag below sets one field of the cache setting.

| Flag                           | Field it sets                        | Default  |
| ------------------------------ | ------------------------------------ | -------- |
| `--cache-by-query-string`      | `cache_vary_by_querystring.behavior` | `ignore` |
| `--query-string-fields`        | `cache_vary_by_querystring.fields`   | None     |
| `--cache-by-cookies`           | `cache_vary_by_cookies.behavior`     | `ignore` |
| `--cookie-names`               | `cache_vary_by_cookies.cookie_names` | None     |
| `--enable-caching-for-post`    | `post` in `cache_vary_by_method`     | None     |
| `--enable-caching-for-options` | `options` in `cache_vary_by_method`  | `false`  |

Azion CLI does not set device-group variation, and it does not set the maximum age of the cache: `--browser-cache-max-age` sets the browser value alone.

---

## HTTP methods

An application natively accepts `GET` and `HEAD`. Application Accelerator adds five more methods, and the responses of two of them can be cached through `cache_vary_by_method`.

| Method added by the module | Response can be cached                             |
| -------------------------- | -------------------------------------------------- |
| `OPTIONS`                  | Yes, when `cache_vary_by_method` carries `options` |
| `POST`                     | Yes, when `cache_vary_by_method` carries `post`    |
| `PUT`                      | No                                                 |
| `PATCH`                    | No                                                 |
| `DELETE`                   | No                                                 |

A cached `POST` or `OPTIONS` object gets its own cache key. For the shape of that key, refer to [Cached HTTP methods](/en/documentation/platform/applications/cache/cache-keys/#variations).

---

## Rules Engine behaviors

Seven Rules Engine behaviors require Application Accelerator on the application that runs the rule. The table indexes them; [Rules Engine](/en/documentation/platform/applications/rules-engine/#behaviors) owns the arguments and the syntax of each one.

| Behavior                                                                                           | Phases            | What it does                                                                                                       |
| -------------------------------------------------------------------------------------------------- | ----------------- | ------------------------------------------------------------------------------------------------------------------ |
| [Add Cookie](/en/documentation/platform/applications/rules-engine/#add-cookie)                     | Request, Response | Adds a cookie to the `Set-Cookie` header.                                                                          |
| [Bypass Cache](/en/documentation/platform/applications/rules-engine/#bypass-cache)                 | Request           | Stops Azion from caching the origin response, and leaves the browser cache untouched.                              |
| [Capture Match Groups](/en/documentation/platform/applications/rules-engine/#capture-match-groups) | Request, Response | Stores the result of a regular expression capture over a request field in a temporary variable.                    |
| [Filter Cookie](/en/documentation/platform/applications/rules-engine/#filter-request-cookie)       | Request, Response | Removes a cookie from the request header sent to the origin, or from the response header sent to the user.         |
| [Forward Cookies](/en/documentation/platform/applications/rules-engine/#forward-cookies)           | Request           | Forwards the `Set-Cookie` header of the origin to users, including on a cache hit.                                 |
| [Rewrite Request](/en/documentation/platform/applications/rules-engine/#rewrite-request)           | Request           | Modifies the resource path requested from the origin.                                                              |
| [Run Function](/en/documentation/platform/applications/rules-engine/#run-function)                 | Request, Response | Runs a function instantiated on the application. Also requires [Functions](/en/documentation/platform/functions/). |

Rule criteria can read `${device_group}`, which requires the module as well. For the variable, refer to [Variables](/en/documentation/platform/applications/rules-engine/#variables), and for the groups it matches, refer to [Device Groups](/en/documentation/platform/applications/device-groups/).

[Set Cache Policy](/en/documentation/platform/applications/rules-engine/#set-cache-policy) does not require the module. It assigns a cache policy created in [Cache Settings](/en/documentation/platform/applications/cache/cache-settings/), and it is how a cache setting reaches a request.

---

## Related resources

- [Cache variation](/en/documentation/platform/applications/application-accelerator/cache-variation.md): How each of these fields changes the cache key, and what a variation costs.
- [Quickstart](/en/documentation/platform/applications/application-accelerator/quickstart.md): Turn the module on and create a cache setting that varies the cache key.
- [Limits](/en/documentation/platform/applications/limits.md#application-accelerator): The ceilings that bound the values in these tables.
- [Real-Time Purge](/en/documentation/platform/applications/cache/real-time-purge.md): How to purge an object that varies by cookie, query string, or device group.
