Skip to content

Commit 60651a3

Browse files
Merge pull request #228394 from duongau/cdnfreshness2
CDN freshness review (Batch 2)
2 parents d007468 + e017947 commit 60651a3

File tree

8 files changed

+64
-78
lines changed

8 files changed

+64
-78
lines changed

articles/cdn/cdn-caching-rules.md

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,33 @@
22
title: Control Azure CDN caching behavior with caching rules | Microsoft Docs
33
description: You can use CDN caching rules to set or modify default cache expiration behavior both globally and with conditions, such as a URL path and file extensions.
44
services: cdn
5-
documentationcenter: ''
65
author: duongau
7-
manager: danielgi
8-
editor: ''
9-
6+
manager: kumud
107
ms.service: azure-cdn
11-
ms.workload: tbd
12-
ms.tgt_pltfrm: na
138
ms.topic: how-to
14-
ms.date: 03/19/2019
9+
ms.date: 02/21/2023
1510
ms.author: duau
1611
---
1712

1813
# Control Azure CDN caching behavior with caching rules
1914

15+
This article describes how you can use content delivery network (CDN) caching rules to set or modify default cache expiration behavior. These caching rules can either be global or with custom conditions, such as a URL path and file extension.
16+
2017
> [!NOTE]
2118
> Caching rules are available only for **Azure CDN Standard from Verizon** and **Azure CDN Standard from Akamai** profiles. For **Azure CDN from Microsoft** profiles, you must use the [Standard rules engine](cdn-standard-rules-engine-reference.md) For **Azure CDN Premium from Verizon** profiles, you must use the [Verizon Premium rules engine](./cdn-verizon-premium-rules-engine.md) in the **Manage** portal for similar functionality.
2219
23-
Azure Content Delivery Network (CDN) offers two ways to control how your files are cached:
20+
Azure Content Delivery Network (CDN) offers two ways to control how your files get cached:
2421

25-
- Caching rules: This article describes how you can use content delivery network (CDN) caching rules to set or modify default cache expiration behavior both globally and with custom conditions, such as a URL path and file extension. Azure CDN provides two types of caching rules:
22+
**Caching rules:** Azure CDN provides two types of caching rules: global and custom.
2623

27-
- Global caching rules: You can set one global caching rule for each endpoint in your profile, which affects all requests to the endpoint. The global caching rule overrides any HTTP cache-directive headers, if set.
24+
- Global caching rules - You can set one global caching rule for each endpoint in your profile, which affects all requests to the endpoint. The global caching rule overrides any HTTP cache-directive headers, if set.
2825

29-
- Custom caching rules: You can set one or more custom caching rules for each endpoint in your profile. Custom caching rules match specific paths and file extensions, are processed in order, and override the global caching rule, if set.
26+
- Custom caching rules - You can set one or more custom caching rules for each endpoint in your profile. Custom caching rules match specific paths and file extensions, get processed in order, and override the global caching rule, if set.
3027

31-
- Query string caching: You can adjust how the Azure CDN treats caching for requests with query strings. For information, see [Control Azure CDN caching behavior with query strings](cdn-query-string.md). If the file is not cacheable, the query string caching setting has no effect, based on caching rules and CDN default behaviors.
28+
**Query string caching:** You can adjust how the Azure CDN treats caching for requests with query strings. For information, see [Control Azure CDN caching behavior with query strings](cdn-query-string.md). If the file isn't cacheable, the query string caching setting has no effect, based on caching rules and CDN default behaviors.
3229

3330
For information about default caching behavior and caching directive headers, see [How caching works](cdn-how-caching-works.md).
3431

35-
3632
## Accessing Azure CDN caching rules
3733

3834
1. Open the Azure portal, select a CDN profile, then select an endpoint.
@@ -49,9 +45,9 @@ For information about default caching behavior and caching directive headers, se
4945
## Caching behavior settings
5046
For global and custom caching rules, you can specify the following **Caching behavior** settings:
5147

52-
- **Bypass cache**: Do not cache and ignore origin-provided cache-directive headers.
48+
- **Bypass cache**: Don't cache and ignore origin-provided cache-directive headers.
5349

54-
- **Override**: Ignore origin-provided cache duration; use the provided cache duration instead. This will not override cache-control: no-cache.
50+
- **Override**: Ignore origin-provided cache duration; use the provided cache duration instead. This setting doesn't override cache-control: no-cache.
5551

5652
> [!NOTE]
5753
> For **Azure CDN from Microsoft** profiles, cache expiration override is only applicable to status codes 200 and 206.
@@ -69,7 +65,7 @@ For global and custom caching rules, you can specify the cache expiration durati
6965

7066
- For the **Override** and **Set if missing** **Caching behavior** settings, valid cache durations range between 0 seconds and 366 days. For a value of 0 seconds, the CDN caches the content, but must revalidate each request with the origin server.
7167

72-
- For the **Bypass cache** setting, the cache duration is automatically set to 0 seconds and cannot be changed.
68+
- For the **Bypass cache** setting, the cache duration gets automatically set to 0 seconds, which isn't a modifiable value.
7369

7470
## Custom caching rules match conditions
7571

@@ -80,30 +76,30 @@ For custom cache rules, two match conditions are available:
8076
- **Extension**: This condition matches the file extension of the requested file. You can provide a list of comma-separated file extensions to match. For example, _.jpg_, _.mp3_, or _.png_. The maximum number of extensions is 50 and the maximum number of characters per extension is 16.
8177

8278
## Global and custom rule processing order
83-
Global and custom caching rules are processed in the following order:
79+
Global and custom caching rules get processed in the following order:
8480

8581
- Global caching rules take precedence over the default CDN caching behavior (HTTP cache-directive header settings).
8682

87-
- Custom caching rules take precedence over global caching rules, where they apply. Custom caching rules are processed in order from top to bottom. That is, if a request matches both conditions, rules at the bottom of the list take precedence over rules at the top of the list. Therefore, you should place more specific rules lower in the list.
83+
- Custom caching rules take precedence over global caching rules, where they apply. Custom caching rules get processed in order from top to bottom. That is, if a request matches both conditions, rules at the bottom of the list take precedence over rules at the top of the list. Therefore, you should place more specific rules lower in the list.
8884

8985
**Example**:
9086
- Global caching rule:
9187
- Caching behavior: **Override**
92-
- Cache expiration duration: 1 day
88+
- Cache expiration duration: One day
9389

9490
- Custom caching rule #1:
9591
- Match condition: **Path**
9692
- Match value: _/home/*_
9793
- Caching behavior: **Override**
98-
- Cache expiration duration: 2 days
94+
- Cache expiration duration: Two days
9995

10096
- Custom caching rule #2:
10197
- Match condition: **Extension**
10298
- Match value: _.html_
10399
- Caching behavior: **Set if missing**
104-
- Cache expiration duration: 3 days
100+
- Cache expiration duration: Three days
105101

106-
When these rules are set, a request for _<endpoint hostname>_.azureedge.net/home/index.html triggers custom caching rule #2, which is set to: **Set if missing** and 3 days. Therefore, if the *index.html* file has `Cache-Control` or `Expires` HTTP headers, they are honored; otherwise, if these headers are not set, the file is cached for 3 days.
102+
When you set these rules, a request for _<endpoint hostname>_.azureedge.net/home/index.html triggers custom caching rule #2, which get set to: **Set if missing** and 3 days. Therefore, if the *index.html* file has `Cache-Control` or `Expires` HTTP headers, they get honored; otherwise, if you don't set these headers, the file gets cached for three days.
107103

108104
> [!NOTE]
109105
> Files that are cached before a rule change maintain their origin cache duration setting. To reset their cache durations, you must [purge the file](cdn-purge-endpoint.md).

0 commit comments

Comments
 (0)