Skip to content

Commit 3ba5de2

Browse files
authored
Merge pull request #190986 from duongau/afdcaching
AFD caching - merge
2 parents eaff4a1 + b6b3a2a commit 3ba5de2

File tree

8 files changed

+71
-101
lines changed

8 files changed

+71
-101
lines changed

.openpublishing.redirection.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -698,6 +698,11 @@
698698
"redirect_url": "/azure/frontdoor/front-door-rules-engine",
699699
"redirect_document_id": false
700700
},
701+
{
702+
"source_path_from_root": "/articles/frontdoor/concept-caching.md",
703+
"redirect_url": "/azure/frontdoor/front-door-caching",
704+
"redirect_document_id": false
705+
},
701706
{
702707
"source_path_from_root": "/articles/frontdoor/concept-route.md",
703708
"redirect_url": "/azure/frontdoor/front-door-route-matching",

articles/frontdoor/front-door-caching.md

Lines changed: 61 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,35 @@
22
title: Azure Front Door - caching | Microsoft Docs
33
description: This article helps you understand behavior for Front Door with routing rules that have enabled caching.
44
services: frontdoor
5-
documentationcenter: ''
65
author: duongau
76
ms.service: frontdoor
87
ms.topic: article
9-
ms.tgt_pltfrm: na
108
ms.workload: infrastructure-services
11-
ms.date: 09/13/2021
9+
ms.date: 03/08/2022
1210
ms.author: duau
11+
zone_pivot_groups: front-door-tiers
1312
---
1413

1514
# Caching with Azure Front Door
15+
16+
::: zone pivot="front-door-standard-premium"
17+
18+
In this article, you'll learn how Front Door Standard/Premium (Preview) Routes and Rule set behaves when you have caching enabled. Azure Front Door is a modern Content Delivery Network (CDN) with dynamic site acceleration and load balancing.
19+
20+
## Request methods
21+
22+
Only the GET request method can generate cached content in Azure Front Door. All other request methods are always proxied through the network.
23+
24+
::: zone-end
25+
26+
::: zone pivot="front-door-classic"
27+
1628
The following document specifies behaviors for Front Door with routing rules that have enabled caching. Front Door is a modern Content Delivery Network (CDN) with dynamic site acceleration and load balancing, it also supports caching behaviors just like any other CDN.
1729

30+
::: zone-end
31+
1832
## Delivery of large files
33+
1934
Azure Front Door delivers large files without a cap on file size. Front Door uses a technique called object chunking. When a large file is requested, Front Door retrieves smaller pieces of the file from the backend. After receiving a full or byte-range file request, the Front Door environment requests the file from the backend in chunks of 8 MB.
2035

2136
After the chunk arrives at the Front Door environment, it's cached and immediately served to the user. Front Door then pre-fetches the next chunk in parallel. This pre-fetch ensures that the content stays one chunk ahead of the user, which reduces latency. This process continues until the entire file gets downloaded (if requested) or the client closes the connection.
@@ -24,6 +39,15 @@ For more information on the byte-range request, read [RFC 7233](https://www.rfc-
2439
Front Door caches any chunks as they're received so the entire file doesn't need to be cached on the Front Door cache. Ensuing requests for the file or byte ranges are served from the cache. If the chunks aren't all cached, pre-fetching is used to request chunks from the backend. This optimization relies on the backend's ability to support byte-range requests. If the backend doesn't support byte-range requests, this optimization isn't effective.
2540

2641
## File compression
42+
43+
::: zone pivot="front-door-standard-premium"
44+
45+
Refer to [improve performance by compressing files](standard-premium/how-to-compression.md) in Azure Front Door.
46+
47+
::: zone-end
48+
49+
::: zone pivot="front-door-classic"
50+
2751
Front Door can dynamically compress content on the edge, resulting in a smaller and faster response time to your clients. In order for a file to be eligible for compression, caching must be enabled and the file must be of a MIME type to be eligible for compression. Currently, Front Door doesn't allow this list to be changed. The current list is:
2852
- "application/eot"
2953
- "application/font"
@@ -78,14 +102,32 @@ When a request for an asset specifies compression and the request results in a c
78102
> [!NOTE]
79103
> Range requests may be compressed into different sizes. Azure Front Door requires the content-length values to be the same for any GET HTTP request. If clients send byte range requests with the `accept-encoding` header that leads to the Origin responding with different content lengths, then Azure Front Door will return a 503 error. You can either disable compression on Origin/Azure Front Door or create a Rules Set rule to remove `accept-encoding` from the request for byte range requests.
80104
105+
::: zone-end
106+
81107
## Query string behavior
108+
82109
With Front Door, you can control how files are cached for a web request that contains a query string. In a web request with a query string, the query string is that portion of the request that occurs after a question mark (?). A query string can contain one or more key-value pairs, in which the field name and its value are separated by an equals sign (=). Each key-value pair is separated by an ampersand (&). For example, `http://www.contoso.com/content.mov?field1=value1&field2=value2`. If there's more than one key-value pair in a query string of a request then their order doesn't matter.
83-
- **Ignore query strings**: In this mode, Front Door passes the query strings from the requestor to the backend on the first request and caches the asset. All ensuing requests for the asset that are served from the Front Door environment ignore the query strings until the cached asset expires.
84110

85-
- **Cache every unique URL**: In this mode, each request with a unique URL, including the query string, is treated as a unique asset with its own cache. For example, the response from the backend for a request for `www.example.ashx?q=test1` is cached at the Front Door environment and returned for ensuing caches with the same query string. A request for `www.example.ashx?q=test2` is cached as a separate asset with its own time-to-live setting.
111+
* **Ignore query strings**: In this mode, Front Door passes the query strings from the requestor to the backend on the first request and caches the asset. All ensuing requests for the asset that are served from the Front Door environment ignore the query strings until the cached asset expires.
112+
113+
* **Cache every unique URL**: In this mode, each request with a unique URL, including the query string, is treated as a unique asset with its own cache. For example, the response from the backend for a request for `www.example.ashx?q=test1` is cached at the Front Door environment and returned for ensuing caches with the same query string. A request for `www.example.ashx?q=test2` is cached as a separate asset with its own time-to-live setting.
114+
115+
::: zone pivot="front-door-standard-premium"
116+
117+
* You can also use Rule Set to specify **cache key query string** behavior, to include, or exclude specified parameters when cache key gets generated. For example, the default cache key is: /foo/image/asset.html, and the sample request is `https://contoso.com//foo/image/asset.html?language=EN&userid=100&sessionid=200`. There's a rule set rule to exclude query string 'userid'. Then the query string cache-key would be `/foo/image/asset.html?language=EN&sessionid=200`.
118+
119+
::: zone-end
86120

87121
## Cache purge
88122

123+
::: zone pivot="front-door-standard-premium"
124+
125+
See [Cache purging in Azure Front Door Standard/Premium (Preview)](standard-premium/how-to-cache-purge.md) to learn how to configure cache purge.
126+
127+
::: zone-end
128+
129+
::: zone pivot="front-door-classic"
130+
89131
Front Door caches assets until the asset's time-to-live (TTL) expires. Whenever a client requests an asset with expired TTL, the Front Door environment retrieves a new updated copy of the asset to serve the request and then stores the refreshed cache.
90132

91133
The best practice to make sure your users always obtain the latest copy of your assets is to version your assets for each update and publish them as new URLs. Front Door will immediately retrieve the new assets for the next client requests. Sometimes you may wish to purge cached content from all edge nodes and force them all to retrieve new updated assets. The reason could be because of updates to your web application, or to quickly update assets that contain incorrect information.
@@ -106,7 +148,10 @@ These formats are supported in the lists of paths to purge:
106148
107149
Cache purges on the Front Door are case-insensitive. Additionally, they're query string agnostic, meaning purging a URL will purge all query-string variations of it.
108150

151+
::: zone-end
152+
109153
## Cache expiration
154+
110155
The following order of headers is used to determine how long an item will be stored in our cache:</br>
111156
1. Cache-Control: s-maxage=\<seconds>
112157
2. Cache-Control: max-age=\<seconds>
@@ -141,5 +186,16 @@ Cache behavior and duration can be configured in both the Front Door designer ro
141186
142187
## Next steps
143188

189+
::: zone pivot="front-door-classic"
190+
144191
- Learn how to [create a Front Door](quickstart-create-front-door.md).
145192
- Learn [how Front Door works](front-door-routing-architecture.md).
193+
194+
::: zone-end
195+
196+
::: zone pivot="front-door-standard-premium"
197+
198+
* Learn more about [Rule Set Match Conditions](standard-premium/concept-rule-set-match-conditions.md)
199+
* Learn more about [Rule Set Actions](front-door-rules-engine-actions.md)
200+
201+
::: zone-end

articles/frontdoor/front-door-routing-architecture.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ If you have defined [rules engines](front-door-rules-engine.md) for the route, t
113113

114114
::: zone pivot="front-door-standard-premium"
115115

116-
If the Front Door routing rule has [caching](standard-premium/concept-caching.md) enabled, and the Front Door edge location's cache includes a valid response for the request, then Front Door returns the cached response.
116+
If the Front Door routing rule has [caching](front-door-caching.md) enabled, and the Front Door edge location's cache includes a valid response for the request, then Front Door returns the cached response.
117117

118118
If caching is disabled or no response is available, the request is forwarded to the origin.
119119

articles/frontdoor/standard-premium/TOC.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
- name: Front Door Manager
3131
href: concept-endpoint-manager.md
3232
- name: Caching
33-
href: concept-caching.md
33+
href: ../front-door-caching.md?toc=%2fazure%2ffrontdoor%2fstandard-premium%2ftoc.json&pivots=front-door-standard-premium
3434
- name: Traffic acceleration
3535
href: ../front-door-traffic-acceleration.md?toc=%2fazure%2ffrontdoor%2fstandard-premium%2ftoc.json&pivots=front-door-standard-premium
3636
- name: Routing

articles/frontdoor/standard-premium/concept-caching.md

Lines changed: 0 additions & 91 deletions
This file was deleted.

articles/frontdoor/standard-premium/how-to-cache-purge.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Best practice is to make sure your users always obtain the latest copy of your a
2727
2828
## Prerequisites
2929

30-
Review [Azure Front Door Caching](concept-caching.md) to understand how caching works.
30+
Review [Azure Front Door Caching](../front-door-caching.md) to understand how caching works.
3131

3232
## Configure cache purge
3333

articles/frontdoor/standard-premium/how-to-configure-https-custom-domain.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,4 +129,4 @@ Grant Azure Front Door permission to access the certificates in your Azure Key
129129

130130
## Next steps
131131

132-
Learn about [caching with Azure Front Door Standard/Premium](concept-caching.md).
132+
Learn about [caching with Azure Front Door Standard/Premium](../front-door-caching.md).

articles/frontdoor/standard-premium/index.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ landingContent:
122122
- linkListType: concept
123123
links:
124124
- text: Caching
125-
url: concept-caching.md
125+
url: ../front-door-caching.md
126126
- linkListType: how-to-guide
127127
links:
128128
- text: Cache purge

0 commit comments

Comments
 (0)