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 query strings or cookies.


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 Settings, select Override Cache Settings to determine a custom TTL value.
  2. Add the TTL in seconds in the Maximum TTL (seconds) field. For example: 432000 = 5 days.

In Edge Cache Settings, 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 Origin Cache Headers 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 Default TTL (seconds) field. If your application is sending these values, to override them:

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

Large File Optimization

Instead of downloading a large content file and risking timeouts or connection terminations, files can be fragmented in 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.

Advanced cache key

The next step is to customize how your content will be cached at the edge through cache keys. You can choose to segment cache keys based on query string or cookies.

To determine content variation in cache:

  1. In Cache by Query String, select Content varies by some Query String fields (Allowlist).
  2. In Query String fields, add the value city.

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.

You can also customize which types of requests can be cached:

  1. Activate the Enable caching for POST switch to cache POST requests.
  2. Activate the Enable caching for OPTIONS switch to cache OPTIONS requests.

Next, you can determine content variation based on cookies:

  1. In Cache by Cookies, select Content varies by some Cookies (Allowlist).
  2. In Cookie names, add the value cookie_name.

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.

Adaptive delivery

If you’ve created a device group, you can segment cache keys based on the device groups you created. To do so:

  1. Select Content varies by some Device Groups (Allowlist).
  2. Click the + Add Device Group button to add a device group.
  3. Select the device group from the list.
  4. Repeat steps 15 and 16 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.

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.


Contributors