Question of the Day

A fresh Microsoft Azure Developer (AZ-204) question every day — build the habit.

You are configuring an Azure CDN endpoint to distribute responses from a weather forecast API. The API serves localized forecast data based on geographic coordinates passed as query string parameters, such as `/forecast?lat=40.7128&lon=-74.0060`. You need to ensure that the CDN endpoint caches unique forecast data for each distinct coordinate combination while maximizing cache efficiency for the rest of the application. Which query string caching behavior should you select?

  1. Cache every unique URLAnswer
  2. B
    Ignore query strings
  3. C
    Bypass caching
  4. D
    Disable caching rules

Answer

Cache every unique URL
Selecting the caching behavior that treats each unique URL as a separate asset ensures that coordinate-specific forecasts are correctly cached and served. This maintains caching benefits while preserving the localized functionality of the weather API.

Step-by-Step Solution

1
Analyze the application requirements.
The application relies on query string parameters (`lat` and `lon`) to serve localized data, meaning each unique coordinate set must yield a separate cached response.
To determine how the CDN should process requests with query parameters without serving incorrect or stale data.
2
Evaluate the caching options available in Azure CDN for query strings.
The main options are: Bypass caching (does not cache requests with query strings), Ignore query strings (caches the first request and serves it to all subsequent query string variants), and Cache every unique URL (caches each query string combination separately).
To align the candidate options with the standard configuration settings of Azure CDN.
3
Select the behavior that caches coordinates separately.
'Cache every unique URL' matches the requirement because it creates a unique cache entry for each query string combination.
This configuration satisfies the need to cache localized forecast data for each coordinate combination while still leveraging the CDN cache.

Key Concept

Azure CDN Query String Caching Behaviors