Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 91e6bf7

Browse files
author
dksimpson
committedApr 20, 2018
Task 906: Split caching rules into tutorial and how to articles
1 parent 3944f04 commit 91e6bf7

File tree

6 files changed

+127
-35
lines changed

6 files changed

+127
-35
lines changed
 

‎articles/cdn/TOC.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
- name: Add a custom domain
1616
href: cdn-map-content-to-custom-domain.md
1717
- name: Configure HTTPS on a custom domain
18-
href: cdn-custom-ssl.md
18+
href: cdn-custom-ssl.md
19+
name: Control caching behavior with caching rules
20+
href: cdn-caching-rules-tutorial.md
1921
- name: Samples
2022
items:
2123
- name: Code samples
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
---
2+
title: Tutorial - Control Azure CDN caching behavior with caching rules | Microsoft Docs
3+
description: In this tutorial, you set a global and a custom CDN caching rule.
4+
services: cdn
5+
documentationcenter: ''
6+
author: dksimpson
7+
manager: akucer
8+
editor: ''
9+
10+
ms.service: cdn
11+
ms.workload: tbd
12+
ms.tgt_pltfrm: na
13+
ms.devlang: na
14+
ms.topic: tutorial
15+
ms.date: 04/19/2018
16+
ms.author: v-deasim
17+
ms.custom: mvc
18+
# As an Azure CDN administrator, I want to create custom rules on my CDN endpoint so that I can control how content is cached.
19+
20+
---
21+
22+
# Tutorial: Control Azure CDN caching behavior with caching rules
23+
24+
> [!NOTE]
25+
> Caching rules are available only for **Azure CDN Standard from Verizon** and **Azure CDN Standard from Akamai**. For **Azure CDN Premium from Verizon**, use the [Azure CDN rules engine](cdn-rules-engine.md) in the **Manage** portal for similar functionality.
26+
27+
Azure Content Delivery Network (CDN) offers two ways to control how your files are cached:
28+
29+
- 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:
30+
- 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.
31+
- 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.
32+
33+
- 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.
34+
35+
For information about default caching behavior and caching directive headers, see [How caching works](cdn-how-caching-works.md).
36+
37+
In this tutorial, you learn how to:
38+
> [!div class="checklist"]
39+
> - Open the caching rules page
40+
> - Create a global caching rule
41+
> - Create a custom caching rule
42+
43+
[!INCLUDE [quickstarts-free-trial-note](../../includes/quickstarts-free-trial-note.md)]
44+
45+
## Prerequisites
46+
47+
Before you can complete the steps in this tutorial, you must first create a CDN profile and at least one CDN endpoint. For more information, see [Quickstart: Create an Azure CDN profile and endpoint](cdn-create-new-endpoint.md).
48+
49+
## Open the Azure CDN caching rules page
50+
51+
1. In the [Azure portal](https://portal.azure.com), select a CDN profile, then select an endpoint.
52+
53+
2. In the left pane under Settings, select **Caching rules**.
54+
55+
![CDN Caching rules button](./media/cdn-caching-rules/cdn-caching-rules-btn.png)
56+
57+
The caching rules page appears.
58+
59+
![CDN Caching rules page](./media/cdn-caching-rules/cdn-caching-rules-page.png)
60+
61+
62+
## Set global caching rules
63+
64+
Create a global caching rule as follows:
65+
66+
1. Under **Global caching rules**, set **Query string caching behavior** to **Ignore query strings**.
67+
68+
2. Set **Caching behavior** to **Set if missing**.
69+
70+
3. For **Cache expiration duration**, enter 10 in the **Days** field.
71+
72+
The global caching rule affects all requests to the endpoint. This rule honors the origin cache-directive headers, if they exist (`Cache-Control` or `Expires`); otherwise, if they are not specified, it sets the cache to 10 days.
73+
74+
![Global caching rules](./media/cdn-caching-rules/cdn-global-caching-rules.png)
75+
76+
## Set custom caching rules
77+
78+
Create a custom caching rule as follows:
79+
80+
1. Under **Custom caching rules**, set **Match condition** to **Path** and **Match value** to `/images/*.jpg`.
81+
82+
2. Set **Caching behavior** to **Override** and enter 30 in the **Days** field.
83+
84+
This custom caching rule sets a cache duration of 30 days on any `.jpg` image files in the `/images` folder of your endpoint. It overrides any `Cache-Control` or `Expires` HTTP headers that are sent by the origin server.
85+
86+
![Custom caching rules](./media/cdn-caching-rules/cdn-custom-caching-rules.png)
87+
88+
89+
## Clean up resources
90+
91+
In the preceding steps, you created caching rules. If you no longer want to use these caching rules, you can remove them by performing these steps:
92+
93+
1. Select a CDN profile, then select the endpoint with the caching rules you want to remove.
94+
95+
2. In the left pane under Settings, select **Caching rules**.
96+
97+
3. Under **Global caching rules**, set **Caching behavior** to **Not set**.
98+
99+
4. Under **Custom caching rules**, select the check box next to the rule you want to delete.
100+
101+
5. Select **Delete**.
102+
103+
6. From the top of the page, select **Save**.
104+
105+
106+
## Next steps
107+
108+
What you learned:
109+
110+
> [!div class="checklist"]
111+
> - Opened the caching rules page
112+
> - Created a global caching rule
113+
> - Created a custom caching rule
114+
115+
Advance to the next tutorial to learn how to configure additional caching rule settings.
116+
117+
> [!div class="nextstepaction"]
118+
> [Control Azure CDN caching behavior with caching rules](cdn-caching rules.md)
119+
120+
121+

‎articles/cdn/cdn-caching-rules.md

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,13 @@ author: dksimpson
77
manager: akucer
88
editor: ''
99

10-
ms.assetid:
1110
ms.service: cdn
1211
ms.workload: tbd
1312
ms.tgt_pltfrm: na
1413
ms.devlang: na
1514
ms.topic: article
16-
ms.date: 10/23/2017
17-
ms.author: rli; v-deasim
18-
15+
ms.date: 04/19/2018
16+
ms.author: v-deasim
1917
---
2018

2119
# Control Azure CDN caching behavior with caching rules
@@ -33,38 +31,10 @@ Azure Content Delivery Network (CDN) offers two ways to control how your files a
3331

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

36-
## Tutorial
37-
38-
How to set CDN caching rules:
39-
40-
1. Open the Azure portal, select a CDN profile, then select an endpoint.
41-
2. In the left pane under Settings, select **Caching rules**.
42-
43-
![CDN Caching rules button](./media/cdn-caching-rules/cdn-caching-rules-btn.png)
44-
45-
3. Create a global caching rule as follows:
46-
1. Under **Global caching rules**, set **Query string caching behavior** to **Ignore query strings**.
47-
2. Set **Caching behavior** to **Set if missing**.
48-
49-
3. For **Cache expiration duration**, enter 10 in the **Days** field.
50-
51-
The global caching rule affects all requests to the endpoint. This rule honors the origin cache-directive headers, if they exist (`Cache-Control` or `Expires`); otherwise, if they are not specified, it sets the cache to 10 days.
52-
53-
![Global caching rules](./media/cdn-caching-rules/cdn-global-caching-rules.png)
54-
55-
4. Create a custom caching rule as follows:
56-
1. Under **Custom caching rules**, set **Match condition** to **Path** and **Match value** to `/images/*.jpg`.
57-
2. Set **Caching behavior** to **Override** and enter 30 in the **Days** field.
58-
59-
This custom caching rule sets a cache duration of 30 days on any `.jpg` image files in the `/images` folder of your endpoint. It overrides any `Cache-Control` or `Expires` HTTP headers that are sent by the origin server.
60-
61-
![Custom caching rules](./media/cdn-caching-rules/cdn-custom-caching-rules.png)
62-
6334

6435
> [!NOTE]
6536
> 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). For **Azure CDN from Verizon** endpoints, it can take up to 90 minutes for caching rules to take effect.
6637
67-
## Reference
6838

6939
### Caching behavior settings
7040
For global and custom caching rules, you can specify the following **Caching behavior** settings:

‎articles/cdn/cdn-map-content-to-custom-domain.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,13 @@ author: dksimpson
77
manager: akucer
88
editor: ''
99

10-
ms.assetid: 289f8d9e-8839-4e21-b248-bef320f9dbfc
1110
ms.service: cdn
1211
ms.workload: media
1312
ms.tgt_pltfrm: na
1413
ms.devlang: na
1514
ms.topic: tutorial
1615
ms.date: 04/06/2018
17-
ms.author: mazha
16+
ms.author: v-deasim
1817
ms.custom: mvc
1918
# As a website owner, I want to add a custom domain to my CDN endpoint so that my users can use my custom domain to access my content.
2019

Loading
Loading

0 commit comments

Comments
 (0)
Please sign in to comment.