Skip to content

Commit 9a7e17d

Browse files
Merge pull request #228781 from duongau/cdnfreshness3
CDN freshness review (Batch 3)
2 parents 29f9cbc + b50e8d1 commit 9a7e17d

File tree

5 files changed

+60
-70
lines changed

5 files changed

+60
-70
lines changed

articles/cdn/cdn-azure-diagnostic-logs.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,15 @@ description: Learn how to use Azure diagnostic logs to save core analytics, whic
55
services: cdn
66
author: duongau
77
manager: KumudD
8-
ms.assetid:
98
ms.service: azure-cdn
109
ms.workload: tbd
1110
ms.tgt_pltfrm: na
1211
ms.topic: troubleshooting
13-
ms.date: 07/15/2020
12+
ms.date: 02/27/2023
1413
ms.author: duau
1514
ms.custom: devx-track-azurepowershell
1615
---
1716

18-
1917
# Diagnostic logs - Azure Content Delivery Network
2018

2119
With Azure diagnostic logs, you can view core analytics and save them into one or more destinations including:
@@ -260,8 +258,8 @@ Not all metrics are available from all providers, although such differences are
260258
| RequestCountCacheHit | Count of all requests that resulted in a Cache hit. The asset was served directly from the POP to the client. | Yes | Yes | No |
261259
| RequestCountCacheMiss | Count of all requests that resulted in a Cache miss. A Cache miss means the asset wasn't found on the POP closest to the client, and was retrieved from the origin. | Yes | Yes | No |
262260
| RequestCountCacheNoCache | Count of all requests to an asset that are prevented from being cached because of a user configuration on the edge. | Yes | Yes | No |
263-
| RequestCountCacheUncacheable | Count of all requests to assets that are prevented from being cached by the asset's Cache-Control and Expires headers. This count indicates that it shouldn't be cached on a POP or by the HTTP client. | Yes | Yes | No |
264-
| RequestCountCacheOthers | Count of all requests with cache status not covered by above. | No | Yes | No |
261+
| RequestCountCacheUncacheable | Count of all requests to assets that are prevented from getting cached by the asset's Cache-Control and Expires headers. This count indicates that it shouldn't be cached on a POP or by the HTTP client. | Yes | Yes | No |
262+
| RequestCountCacheOthers | Count of all requests with cache status not covered by metrics listed previously. | No | Yes | No |
265263
| EgressTotal | Outbound data transfer in GB | Yes |Yes |Yes |
266264
| EgressHttpStatus2xx | Outbound data transfer* for responses with 2xx HTTP status codes in GB. | Yes | Yes | No |
267265
| EgressHttpStatus3xx | Outbound data transfer for responses with 3xx HTTP status codes in GB. | Yes | Yes | No |
@@ -271,7 +269,7 @@ Not all metrics are available from all providers, although such differences are
271269
| EgressCacheHit | Outbound data transfer for responses that were delivered directly from the CDN cache on the CDN POPs/Edges. | Yes | Yes | No |
272270
| EgressCacheMiss. | Outbound data transfer for responses that weren't found on the nearest POP server, and retrieved from the origin server. | Yes | Yes | No |
273271
| EgressCacheNoCache | Outbound data transfer for assets that are prevented from being cached because of a user configuration on the edge. | Yes | Yes | No |
274-
| EgressCacheUncacheable | Outbound data transfer for assets that are prevented from being cached by the asset's Cache-Control and, or Expires headers. Indicates that it shouldn't be cached on a POP or by the HTTP client. | Yes | Yes | No |
272+
| EgressCacheUncacheable | Outbound data transfer for assets that are prevented from getting cached by the asset's Cache-Control and, or Expires headers. Indicates that it shouldn't be cached on a POP or by the HTTP client. | Yes | Yes | No |
275273
| EgressCacheOthers | Outbound data transfers for other cache scenarios. | No | Yes | No |
276274
277275
*Outbound data transfer refers to traffic delivered from CDN POP servers to the client.
@@ -362,7 +360,7 @@ Example properties:
362360

363361
```
364362

365-
## Additional resources
363+
## More resources
366364

367365
* [Azure Diagnostic logs](../azure-monitor/essentials/platform-logs-overview.md)
368366
* [Core analytics via Azure CDN supplemental portal](./cdn-analyze-usage-patterns.md)

articles/cdn/cdn-cors.md

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,40 +2,40 @@
22
title: Using Azure CDN with CORS | Microsoft Docs
33
description: Learn how to use the Azure Content Delivery Network (CDN) to with Cross-Origin Resource Sharing (CORS).
44
services: cdn
5-
documentationcenter: ''
6-
author: zhangmanling
7-
manager: erikre
8-
editor: ''
9-
5+
author: duongau
6+
manager: kumud
107
ms.assetid: 86740a96-4269-4060-aba3-a69f00e6f14e
118
ms.service: azure-cdn
129
ms.workload: tbd
1310
ms.tgt_pltfrm: na
1411
ms.topic: how-to
15-
ms.date: 01/23/2017
12+
ms.date: 02/27/2023
1613
ms.author: mazha
1714

1815
---
1916
# Using Azure CDN with CORS
17+
2018
## What is CORS?
21-
CORS (Cross Origin Resource Sharing) is an HTTP feature that enables a web application running under one domain to access resources in another domain. In order to reduce the possibility of cross-site scripting attacks, all modern web browsers implement a security restriction known as [same-origin policy](https://www.w3.org/Security/wiki/Same_Origin_Policy). This prevents a web page from calling APIs in a different domain. CORS provides a secure way to allow one origin (the origin domain) to call APIs in another origin.
19+
20+
CORS (Cross Origin Resource Sharing) is an HTTP feature that enables a web application running under one domain to access resources in another domain. In order to reduce the possibility of cross-site scripting attacks, all modern web browsers implement a security restriction known as [same-origin policy](https://www.w3.org/Security/wiki/Same_Origin_Policy). This restriction prevents a web page from calling APIs in a different domain. CORS provides a secure way to allow one origin (the origin domain) to call APIs in another origin.
2221

2322
## How it works
23+
2424
There are two types of CORS requests, *simple requests* and *complex requests.*
2525

2626
### For simple requests:
2727

28-
1. The browser sends the CORS request with an additional **Origin** HTTP request header. The value of this header is the origin that served the parent page, which is defined as the combination of *protocol,* *domain,* and *port.* When a page from https\://www.contoso.com attempts to access a user's data in the fabrikam.com origin, the following request header would be sent to fabrikam.com:
28+
1. The browser sends the CORS request with an extra **Origin** HTTP request header. The value of the request header is the origin that served the parent page, which is defined as the combination of *protocol,* *domain,* and *port.* When a page from https\://www.contoso.com attempts to access a user's data in the fabrikam.com origin, the following request header would be sent to fabrikam.com:
2929

3030
`Origin: https://www.contoso.com`
3131

32-
2. The server may respond with any of the following:
32+
2. The server may respond with any of the following headers:
3333

3434
* An **Access-Control-Allow-Origin** header in its response indicating which origin site is allowed. For example:
3535

3636
`Access-Control-Allow-Origin: https://www.contoso.com`
3737

38-
* An HTTP error code such as 403 if the server does not allow the cross-origin request after checking the Origin header
38+
* An HTTP error code such as 403 if the server doesn't allow the cross-origin request after checking the Origin header
3939

4040
* An **Access-Control-Allow-Origin** header with a wildcard that allows all origins:
4141

@@ -51,31 +51,34 @@ A complex request is a CORS request where the browser is required to send a *pre
5151
>
5252
5353
## Wildcard or single origin scenarios
54-
CORS on Azure CDN will work automatically with no additional configuration when the **Access-Control-Allow-Origin** header is set to wildcard (*) or a single origin. The CDN will cache the first response and subsequent requests will use the same header.
5554

56-
If requests have already been made to the CDN prior to CORS being set on your origin, you will need to purge content on your endpoint content to reload the content with the **Access-Control-Allow-Origin** header.
55+
CORS on Azure CDN works automatically without extra configurations when the **Access-Control-Allow-Origin** header is set to wildcard (*) or a single origin. CDN cache the first response and subsequent requests use the same header.
56+
57+
If requests have already been made to the CDN prior to CORS being set on your origin, you need to purge content on your endpoint content to reload the content with the **Access-Control-Allow-Origin** header.
5758

5859
## Multiple origin scenarios
59-
If you need to allow a specific list of origins to be allowed for CORS, things get a little more complicated. The problem occurs when the CDN caches the **Access-Control-Allow-Origin** header for the first CORS origin. When a different CORS origin makes a subsequent request, the CDN will serve the cached **Access-Control-Allow-Origin** header, which won't match. There are several ways to correct this.
60+
If you need to allow a specific list of origins to be allowed for CORS, things get a little more complicated. The problem occurs when the CDN caches the **Access-Control-Allow-Origin** header for the first CORS origin. When a different CORS origin makes a subsequent request, the CDN serves the cached **Access-Control-Allow-Origin** header, which doesn't match. There are several ways to correct this problem.
6061

6162
### Azure CDN standard profiles
62-
On Azure CDN Standard from Microsoft, you can create a rule in the [Standard rules engine](cdn-standard-rules-engine-reference.md) to check the **Origin** header on the request. If it's a valid origin, your rule will set the **Access-Control-Allow-Origin** header with the desired value. In this case, the **Access-Control-Allow-Origin** header from the file's origin server is ignored and the CDN's rules engine completely manages the allowed CORS origins.
63+
On Azure CDN Standard from Microsoft, you can create a rule in the [Standard rules engine](cdn-standard-rules-engine-reference.md) to check the **Origin** header on the request. If it's a valid origin, your rule set the **Access-Control-Allow-Origin** header with the desired value. In this case, the **Access-Control-Allow-Origin** header from the file's origin server is ignored and the CDN's rules engine completely manages the allowed CORS origins.
6364

6465
![Rules example with standard rules engine](./media/cdn-cors/cdn-standard-cors.png)
6566

6667
> [!TIP]
6768
> You can add additional actions to your rule to modify additional response headers, such as **Access-Control-Allow-Methods**.
6869
>
6970
70-
On **Azure CDN Standard from Akamai**, the only mechanism to allow for multiple origins without the use of the wildcard origin is to use [query string caching](cdn-query-string.md). Enable the query string setting for the CDN endpoint and then use a unique query string for requests from each allowed domain. Doing so will result in the CDN caching a separate object for each unique query string. This approach is not ideal, however, as it will result in multiple copies of the same file cached on the CDN.
71+
On **Azure CDN Standard from Akamai**, the only mechanism to allow for multiple origins without the use of the wildcard origin is to use [query string caching](cdn-query-string.md). Enable the query string setting for the CDN endpoint and then use a unique query string for requests from each allowed domain. Doing so results in the CDN caching a separate object for each unique query string. This approach isn't ideal, however, as it results in multiple copies of the same file cached on the CDN.
7172

7273
### Azure CDN Premium from Verizon
73-
Using the Verizon Premium rules engine, You'll need to [create a rule](./cdn-verizon-premium-rules-engine.md) to check the **Origin** header on the request. If it's a valid origin, your rule will set the **Access-Control-Allow-Origin** header with the origin provided in the request. If the origin specified in the **Origin** header is not allowed, your rule should omit the **Access-Control-Allow-Origin** header, which will cause the browser to reject the request.
7474

75-
There are two ways to do this with the Premium rules engine. In both cases, the **Access-Control-Allow-Origin** header from the file's origin server is ignored and the CDN's rules engine completely manages the allowed CORS origins.
75+
Using the Verizon Premium rules engine, you need to [create a rule](./cdn-verizon-premium-rules-engine.md) to check the **Origin** header on the request. If it's a valid origin, your rule sets the **Access-Control-Allow-Origin** header with the origin provided in the request. If the origin specified in the **Origin** header isn't allowed, your rule should omit the **Access-Control-Allow-Origin** header, which causes the browser to reject the request.
76+
77+
There are two ways to resolve this problem with the Premium rules engine. In both cases, the **Access-Control-Allow-Origin** header from the file's origin server is ignored and the CDN's rules engine completely manages the allowed CORS origins.
7678

7779
#### One regular expression with all valid origins
78-
In this case, you'll create a regular expression that includes all of the origins you want to allow:
80+
81+
In this case, you create a regular expression that includes all of the origins you want to allow:
7982

8083
```http
8184
https?:\/\/(www\.contoso\.com|contoso\.com|www\.microsoft\.com|microsoft.com\.com)$
@@ -86,7 +89,7 @@ https?:\/\/(www\.contoso\.com|contoso\.com|www\.microsoft\.com|microsoft.com\.co
8689
>
8790
>
8891
89-
If the regular expression matches, your rule will replace the **Access-Control-Allow-Origin** header (if any) from the origin with the origin that sent the request. You can also add additional CORS headers, such as **Access-Control-Allow-Methods**.
92+
If the regular expression matches, your rule replaces the **Access-Control-Allow-Origin** header (if any) from the origin with the origin that sent the request. You can also add extra CORS headers, such as **Access-Control-Allow-Methods**.
9093

9194
![Rules example with regular expression](./media/cdn-cors/cdn-cors-regex.png)
9295

@@ -96,6 +99,6 @@ Rather than regular expressions, you can instead create a separate rule for each
9699
![Rules example without regular expression](./media/cdn-cors/cdn-cors-no-regex.png)
97100

98101
> [!TIP]
99-
> In the example above, the use of the wildcard character * tells the rules engine to match both HTTP and HTTPS.
102+
> In the example, the use of the wildcard character * tells the rules engine to match both HTTP and HTTPS.
100103
>
101104
>

articles/cdn/cdn-manage-expiration-of-blob-content.md

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,17 @@
22
title: Manage expiration of Azure Blob storage
33
titleSuffix: Azure Content Delivery Network
44
description: Learn about the options for controlling time-to-live for blobs in Azure CDN caching.
5-
services: cdn
6-
documentationcenter:
7-
author: zhangmanling
8-
manager: erikre
9-
editor: ''
10-
5+
services: cdn
6+
author: duongau
7+
manager: kumudd
118
ms.assetid: ad4801e9-d09a-49bf-b35c-efdc4e6034e8
129
ms.service: azure-cdn
1310
ms.workload: media
1411
ms.tgt_pltfrm: na
1512
ms.devlang: csharp
1613
ms.topic: how-to
17-
ms.date: 02/1/2018
18-
ms.author: mazha
14+
ms.date: 02/27/2023
15+
ms.author: duau
1916
ms.custom: devx-track-azurepowershell
2017

2118
---
@@ -24,9 +21,8 @@ ms.custom: devx-track-azurepowershell
2421
> * [Azure web content](cdn-manage-expiration-of-cloud-service-content.md)
2522
> * [Azure Blob storage](cdn-manage-expiration-of-blob-content.md)
2623
>
27-
>
2824
29-
The [Blob storage service](../storage/common/storage-introduction.md#blob-storage) in Azure Storage is one of several Azure-based origins integrated with Azure Content Delivery Network (CDN). Any publicly accessible blob content can be cached in Azure CDN until its time-to-live (TTL) elapses. The TTL is determined by the `Cache-Control` header in the HTTP response from the origin server. This article describes several ways that you can set the `Cache-Control` header on a blob in Azure Storage.
25+
The [Blob storage service](../storage/common/storage-introduction.md#blob-storage) in Azure Storage is one of several Azure-based origins integrated with Azure Content Delivery Network (CDN). Any publicly accessible blob content can be cached in Azure CDN until its time-to-live (TTL) elapses. The TTL gets determined by the `Cache-Control` header in the HTTP response from the origin server. This article describes several ways that you can set the `Cache-Control` header on a blob in Azure Storage.
3026

3127
You can also control cache settings from the Azure portal by setting CDN caching rules. If you create a caching rule and set its caching behavior to **Override** or **Bypass cache**, the origin-provided caching settings discussed in this article are ignored. For information about general caching concepts, see [How caching works](cdn-how-caching-works.md).
3228

@@ -65,7 +61,7 @@ The preferred method for setting a blob's `Cache-Control` header is to use cachi
6561

6662
![CDN global caching rules example](./media/cdn-manage-expiration-of-blob-content/cdn-global-caching-rules-example.png)
6763

68-
This global caching rule sets a cache duration of one hour and affects all requests to the endpoint. It overrides any `Cache-Control` or `Expires` HTTP headers that are sent by the origin server specified by the endpoint.
64+
This global caching rule sets a cache duration of one hour and affects all requests to the endpoint. It overrides any `Cache-Control` or `Expires` HTTP headers that get sent by the origin server specified by the endpoint.
6965

7066
3. Select **Save**.
7167

0 commit comments

Comments
 (0)