Question

Difficulty: HardConfigure and Manage Azure CDN Endpoints and Caching Rules

You are configuring caching rules for an Azure CDN Standard from Microsoft endpoint that delivers content for a web application. The application has the following requirements:
- The homepage (/index.html) must cache promotional landing pages differently based on the query string parameters (e.g., ?promo=summer vs ?promo=winter).
- Rest API endpoints under the path /api/ must never be cached by the CDN, regardless of any caching headers returned by the origin server.

Which two configurations should you apply to meet these requirements?

  1. Configure the global query string caching behavior to Cache every unique URL.Answer
  2. Create a custom caching rule with a match path of /api/* and set the caching behavior to Bypass cache.Answer
  3. C
    Configure the global query string caching behavior to Bypass caching.
  4. D
    Create a custom caching rule with a match path of /api/* and set the caching behavior to Set if missing.

Answer

Configure the global query string caching behavior to Cache every unique URL, and create a custom caching rule with a match path of /api/* and set the caching behavior to Bypass cache.
Configuring the global query string caching behavior to 'Cache every unique URL' ensures that each unique promotional query string serves a cached page specific to that parameter. Creating a custom caching rule for the path /api/* with the caching behavior 'Bypass cache' ensures that API endpoints are never cached by the CDN, ignoring any cache-control headers from the origin server.

Step-by-Step Solution

1
Analyze the query string caching requirement.
Since different versions of /index.html must be cached based on the query string parameters, the CDN needs to treat each unique query string URL as a separate cacheable resource.
This is achieved by setting the global query string caching behavior to 'Cache every unique URL'.
2
Analyze the API caching requirement.
API endpoints under the path /api/ must never be cached by the CDN, regardless of origin headers.
Creating a custom caching rule targeting /api/* with the caching behavior set to 'Bypass cache' overrides all origin headers and prevents the CDN from caching these endpoints.

Key Concept

Azure CDN caching rules allow customizing how files are cached based on file paths, file extensions, and query string parameters. Custom caching rules can override or bypass origin cache-control headers, and query string caching behavior determines how the CDN caches unique URLs containing query strings.
Rate this question