Soru

Zorluk: Çok zorConfigure and Manage Azure CDN Endpoints and Caching Rules

An enterprise is deploying a web application behind an Azure CDN Standard from Microsoft endpoint. The application has three categories of assets with distinct caching requirements:

* `/reports/*`: Serves sensitive, user-specific PDF reports generated on-demand with query parameters (e.g., `/reports/download?user=123&token=abc`). These must never be cached on the CDN edge servers.
* `/images/*`: Contains product photos that are updated using a version query parameter (e.g., `/images/keyboard.jpg?ver=2.4`). To ensure immediate updates, the CDN must cache these based on the `ver` parameter only, while ignoring all tracking parameters (e.g., `utm_source`) to prevent cache pollution.
* `/styles/*`: Contains static CSS files where the origin server does not set any `Cache-Control` headers. These files must be cached for exactly 14 days, regardless of any future caching headers added to the origin server.

The endpoint's global Query String Caching behavior is set to 'Ignore query strings'.

Which configuration of caching rules and rules engine rules should you implement to meet these requirements?

  1. A
    Create a Rules Engine rule matching `/reports/*` with the Cache expiration action set to Bypass cache. Create a Rules Engine rule matching `/images/*` with the Cache-key query string action set to Include all. Create a Rules Engine rule matching `/styles/*` with the Cache expiration action set to Set if missing with a duration of 14 days.
  2. B
    Create a Custom Caching Rule matching `/reports/*` with the caching behavior set to Bypass cache. Create a Custom Caching Rule matching `/images/*` with the caching behavior set to Cache every unique URL and a duration of 30 days. Create a Custom Caching Rule matching `/styles/*` with the caching behavior set to Set if missing with a duration of 14 days.
  3. Create a Rules Engine rule matching `/reports/*` with the Cache expiration action set to Bypass cache. Create a Rules Engine rule matching `/images/*` with the Cache-key query string action set to Include with the parameter value `ver`. Create a Rules Engine rule matching `/styles/*` with the Cache expiration action set to Override with a duration of 14 days.Cevap
  4. D
    Create a Rules Engine rule matching `/reports/*` with the Cache expiration action set to Bypass cache. Create a Rules Engine rule matching `/images/*` with the Query-string caching behavior action set to Cache every unique URL. Create a Rules Engine rule matching `/styles/*` with the Cache expiration action set to Override with a duration of 14 days.

Cevap

The correct configuration is to create three Rules Engine rules: one bypassing the cache for `/reports/*`, one using the Cache-key query string action with the Include behavior for parameter `ver` on `/images/*`, and one setting Cache expiration to Override with a duration of 14 days on `/styles/*`.
The correct configuration utilizes the Azure CDN Standard Rules Engine to target specific paths and apply fine-grained caching rules. For the sensitive reports, bypassing the cache entirely ensures security. For the versioned images, using the Cache-key query string action with the Include behavior and specifying the 'ver' parameter ensures that only changes to the version number result in a new cache entry, while other parameters (like tracking codes) are ignored to prevent cache pollution. For the stylesheets, setting Cache expiration to Override guarantees that the CDN caches the assets for 14 days, ignoring any future Cache-Control headers returned by the origin server.

Adım Adım Çözüm

1
Analyze the caching requirement for the `/reports/*` path, which contains sensitive user-specific data.
Determine that caching must be bypassed entirely. This requires configuring a match rule for the path `/reports/*` and setting the Cache expiration action to 'Bypass cache'.
Bypassing the cache ensures that sensitive user-specific reports are never stored on CDN edge servers, preventing data leakage.
2
Analyze the caching and query string requirement for the `/images/*` path.
Determine that version query strings (`ver`) must trigger cache updates, but other query strings (like tracking parameters) must be ignored. This requires the 'Cache-key query string' action set to 'Include' with the parameter name 'ver'.
Including only the 'ver' parameter in the cache key ensures version updates are immediately reflected, while ignoring tracking parameters prevents cache pollution and low cache hit ratios.
3
Analyze the caching requirement for the `/styles/*` path.
Determine that stylesheets must be cached for exactly 14 days regardless of future origin headers. This requires configuring a match rule for `/styles/*` and setting the Cache expiration action to 'Override' with a duration of 14 days.
Using 'Override' ensures that the CDN-specified TTL is enforced even if the origin server starts sending Cache-Control headers, whereas 'Set if missing' would honor the origin's headers.

Anahtar Kavram

Fine-grained caching control using the Azure CDN Standard Rules Engine and Cache-key query string configurations.
Tahmini Süre:3m 0s
Bu soruyu puanla