You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/frontdoor/front-door-caching.md
+61-5Lines changed: 61 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,20 +2,35 @@
2
2
title: Azure Front Door - caching | Microsoft Docs
3
3
description: This article helps you understand behavior for Front Door with routing rules that have enabled caching.
4
4
services: frontdoor
5
-
documentationcenter: ''
6
5
author: duongau
7
6
ms.service: frontdoor
8
7
ms.topic: article
9
-
ms.tgt_pltfrm: na
10
8
ms.workload: infrastructure-services
11
-
ms.date: 09/13/2021
9
+
ms.date: 03/08/2022
12
10
ms.author: duau
11
+
zone_pivot_groups: front-door-tiers
13
12
---
14
13
15
14
# 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
+
16
28
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.
17
29
30
+
::: zone-end
31
+
18
32
## Delivery of large files
33
+
19
34
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.
20
35
21
36
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-
24
39
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.
25
40
26
41
## 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
+
27
51
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:
28
52
- "application/eot"
29
53
- "application/font"
@@ -78,14 +102,32 @@ When a request for an asset specifies compression and the request results in a c
78
102
> [!NOTE]
79
103
> 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.
80
104
105
+
::: zone-end
106
+
81
107
## Query string behavior
108
+
82
109
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.
84
110
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
86
120
87
121
## Cache purge
88
122
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
+
89
131
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.
90
132
91
133
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:
106
148
107
149
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.
108
150
151
+
::: zone-end
152
+
109
153
## Cache expiration
154
+
110
155
The following order of headers is used to determine how long an item will be stored in our cache:</br>
111
156
1. Cache-Control: s-maxage=\<seconds>
112
157
2. Cache-Control: max-age=\<seconds>
@@ -141,5 +186,16 @@ Cache behavior and duration can be configured in both the Front Door designer ro
141
186
142
187
## Next steps
143
188
189
+
::: zone pivot="front-door-classic"
190
+
144
191
- Learn how to [create a Front Door](quickstart-create-front-door.md).
145
192
- 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)
Copy file name to clipboardExpand all lines: articles/frontdoor/front-door-routing-architecture.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -113,7 +113,7 @@ If you have defined [rules engines](front-door-rules-engine.md) for the route, t
113
113
114
114
::: zone pivot="front-door-standard-premium"
115
115
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.
117
117
118
118
If caching is disabled or no response is available, the request is forwarded to the origin.
0 commit comments