How to tune your cache settings

Leverage the capabilities of Edge Cache to configure your edge application’s cache policies, including expiration values at the edge or browser level, large file optimization to break large files into smaller chunks, and cache key segmentation based on HTTP methods, query strings, cookies, or device groups.


When you first create an edge application, a cache setting variable will be created and activated by default. This guide will show you how to create and activate a brand new cache setting instance.

  1. Access Azion Console > Edge Application.
  2. Click the edge application you want to configure.
  3. Activate the Application Accelerator module to unlock advanced cache key configurations.
  4. Click the Save button.
  5. Navigate to the Cache Settings tab.
  6. Click the + Cache Setting button.
  7. Give your cache setting a name.

Cache Expiration Policies

You can customize the cache Time To Live (TTL) in browsers and at the edge. This data is sent in requests and responses through the Cache-Control and Expires HTTP headers.

  1. In Browser Cache, select Override cache settings to determine a custom TTL value.
  2. Add the TTL in seconds in the Max Age (seconds) field. For example: 432000 = 5 days.

In Edge Cache, you can determine whether the edge should abide by the values sent in the Cache-Control and Expires headers.

You can choose to keep Honor cache policies selected to respect the TTL values sent in the headers by the origin or the application itself.

If your application isn’t sending Cache-Control and Expires headers or the values aren’t set correctly, you can determine a default maximum TTL for the cache to be maintained at the edge in the Max Age (seconds) field. If your application is sending these values, to override them:

  1. In Edge Cache, select Override cache settings to determine a custom TTL value.
  2. Add the TTL in seconds in the Max Age (seconds) field. For example: 864000 = 10 days.

Stale cache

Azion provides the capability to serve stale content from the cache when the origin server is down or while the cache is being renewed. The Stale cache feature is enabled by default, allowing your application to continue serving the most recent cached content during these events.

Large file optimization

Instead of downloading a large content file and risking timeouts or connection terminations, files can be fragmented into smaller pieces and cached on-demand.

  1. In Large file optimization, enable the switch to activate.
  2. The Edge Cache layer is already selected by default. If you have the Tiered Cache module activated, you can also enable this feature for the tiered cache layer.

Application Accelerator

This section lets you customize how cache varies based on HTTP methods, query string fields, cookies and device groups through cache keys. You can choose to segment cache keys using these attributes to control how objects are stored and served from the cache.

To determine content variation in cache:

  1. In Cache vary by Method, activate the Enable caching for POST switch to cache POST requests and the Enable caching for OPTIONS switch to cache OPTIONS requests.

  2. In Cache vary by Query String, select Content varies by some query string fields (Allowlist).

  3. In Query string fields, add the value city.

  • This field is case‑sensitive and treats uppercase and lowercase letters differently when storing objects in the cache.

When a request is made to an application URL xxxxxxxxxx.map.azionedge.net/page?city=12345, the cache key for this URL will be different from cache keys made to xxxxxxxxxx.map.azionedge.net/page and any other queries appended to the URL.

To disregard the order of the data sent in the query string and keep objects with the same query string values as a single cache key:

  1. Enable the Query String sort switch.

  2. In Cache vary by Cookies, select Content varies by some cookies (Allowlist).

  3. In Cookie names, add the value cookie_name.

  • This field is case‑sensitive and treats uppercase and lowercase letters differently when storing objects in the cache.

When a request is made to an application and the response from the origin sends a Set‑Cookie header, the objects in the Cookie request header that contain the name cookie_name, regardless of value, will be considered as a different object in cache from other requests.

  1. In Cache vary by Devices, select Content varies by some device groups (Allowlist).
  2. Click the + Add Device Group button to add a device group and select it from the list.
  3. Repeat the previous step for every device group you wish to specify a different cache key.

Once you’ve finished configuring your cache setting:

  1. Click the Save button.

Activating your cache setting

The cache settings page now lists the newly created instance. However, this new cache setting isn’t active in your application. You need to define what will trigger the implementation of the cache policies in your application. For this, you can use your edge application’s Rules Engine.

The instructions below will help you create a rule in which any request from your users to xxxxxxxxxx.map.azionedge.net/cache will apply the cache setting you created.

  1. Navigate to the Rules Engine tab.
  2. Click the + Rule button.
  3. Give a name for your rule.
  4. Select Request Phase.
  5. Under the Criteria section, select the variable ${uri}.
  1. As a comparison operator, select is equal.
  2. As an argument, add /cache.
  3. In the Behaviors section, select Set Cache Policy from the behavior list.
  4. Select the new cache setting you created.
  5. Click the Save button.
  6. Wait a few minutes for the changes to propagate.

To verify how your content is being cached, you can verify application cache indicators using Modheader for Google Chrome.