Configure caching

3.3 Azure Front Door

📘Microsoft Azure Networking Solutions (AZ-700)


Caching is one of the most important features of Azure Front Door. It improves performance, reduces load on backend servers, and lowers bandwidth costs.

For the AZ-700 exam, you must understand:

  • What caching is
  • How Azure Front Door caching works
  • Caching configuration options
  • Caching behavior settings
  • Query string caching
  • Compression
  • Time-to-Live (TTL)
  • When to use or not use caching

Let’s explain everything in simple and clear language.


1. What Is Caching?

Caching means storing a copy of content at a location closer to users so it can be delivered faster next time.

In Azure Front Door:

  • Static content (images, CSS, JavaScript, files) is stored at Microsoft edge locations.
  • When another user requests the same file, it is served from the edge location.
  • The request does NOT go back to the backend server.

This reduces:

  • Backend CPU usage
  • Network traffic
  • Response time

2. How Caching Works in Azure Front Door

Azure Front Door works as a global reverse proxy and CDN.

When a user requests content:

  1. The request goes to the nearest Front Door edge location.
  2. Front Door checks if the content is cached.
    • If cached → Content is returned immediately (cache hit).
    • If not cached → Request goes to backend (cache miss).
  3. Backend response is stored in cache (if eligible).
  4. Future requests are served from cache.

3. What Can Be Cached?

Azure Front Door caches static content, such as:

  • Images (.jpg, .png)
  • CSS files
  • JavaScript files
  • Static HTML
  • Downloadable files

By default:

  • Only GET requests are cached.
  • POST requests are NOT cached.
  • Dynamic content is usually not cached unless configured.

4. Where Do You Configure Caching?

Caching is configured inside:

  • Front Door profile
  • Endpoint
  • Route

Caching settings are applied at the route level.

Important for exam:

Caching is enabled per route, not globally for the entire profile.


5. Cache Configuration Settings

When configuring caching in Azure Front Door, you control:

1️⃣ Enable/Disable Caching

You must explicitly enable caching on the route.

If caching is disabled:

  • Every request goes to backend.

2️⃣ Cache Behavior (TTL Control)

TTL = Time To Live
This defines how long content stays in cache.

There are two main options:

A) Honor origin cache headers (Recommended)

Front Door respects backend headers like:

  • Cache-Control
  • Expires

This means the backend controls how long content stays cached.

B) Override

Front Door ignores backend headers and uses:

  • Custom TTL value

You can define:

  • Minimum TTL
  • Maximum TTL
  • Default TTL

Exam Tip:

If backend headers are not configured correctly, override TTL at Front Door.


6. Query String Caching Behavior

This is very important for AZ-700.

When a URL contains query strings:

Example:

https://contoso.com/image.png?version=1

Azure Front Door gives three options:

1️⃣ Ignore Query String

  • Cache based only on the path.
  • All query string versions return the same cached file.
  • Best for static files.

2️⃣ Cache Every Unique URL

  • Each unique query string is cached separately.
  • More precise but uses more cache storage.

3️⃣ Ignore Specified Query Strings

  • You define which query parameters to ignore.

Exam Scenario:
If versioning is done using query strings (e.g., ?v=2), choose:
→ Cache every unique URL


7. Compression

Azure Front Door supports compression for cached content.

It reduces file size before sending to user.

Supported formats:

  • Gzip
  • Brotli

Compression improves:

  • Performance
  • Bandwidth efficiency

Important:

  • Only certain file types are compressed.
  • Compression is configured per route.

8. Cache Expiration (TTL) Explained Clearly

TTL determines how long content stays in cache before refreshing.

Example:

  • TTL = 1 hour
  • After 1 hour → Front Door requests updated content from backend

Low TTL:

  • Content updates quickly
  • More backend requests

High TTL:

  • Better performance
  • Less backend traffic
  • Slower updates

For static content:

  • Use longer TTL

For frequently updated content:

  • Use shorter TTL

9. Cache Invalidation (Purge)

Sometimes content changes before TTL expires.

Azure Front Door allows:

  • Manual purge
  • Path-based purge
  • Wildcard purge

This removes cached content immediately.

Important for exam:

Purge does NOT delete backend content.
It only removes cached copies from edge locations.


10. Caching and Backend Headers

Backend servers may send:

Cache-Control: public, max-age=3600

If Front Door is set to:

  • Honor origin → uses this value
  • Override → ignores it

If backend sends:

Cache-Control: no-cache

Content will not be cached (unless override is used).


11. When NOT to Use Caching

Do NOT cache:

  • User-specific content
  • Authentication pages
  • Payment systems
  • API responses with personal data
  • Frequently changing database results

Reason:
Caching may serve outdated or incorrect content to users.


12. Common Exam Scenarios

Scenario 1:

Company wants static files cached globally.
Solution:

  • Enable caching
  • Honor origin headers or set high TTL

Scenario 2:

Backend does not send cache headers.
Solution:

  • Override TTL in Front Door

Scenario 3:

Website uses version query strings (?v=1, ?v=2).
Solution:

  • Cache every unique URL

Scenario 4:

New file deployed but users still see old version.
Solution:

  • Perform cache purge

13. Caching vs CDN

Azure Front Door includes CDN-like caching functionality.

It:

  • Stores content at edge locations
  • Improves global performance
  • Reduces origin load

But it also provides:

  • WAF
  • Routing
  • SSL offload
  • Load balancing

14. Key Points to Remember for AZ-700

✔ Caching is configured per route
✔ Only GET requests are cached
✔ TTL controls cache duration
✔ Query string behavior is very important
✔ Compression improves performance
✔ Purge removes cached copies
✔ Override TTL if backend headers are incorrect
✔ Do not cache sensitive or dynamic content


15. Simple Summary (For Non-IT Understanding)

Azure Front Door caching means:

  • Store website files closer to users.
  • Deliver content faster.
  • Reduce load on backend servers.
  • Save bandwidth and cost.
  • Control how long files stay stored.
  • Remove stored files manually if needed.

Final Exam Preparation Checklist

Before the exam, make sure you understand:

  • Cache hit vs cache miss
  • TTL configuration
  • Query string caching options
  • When to override origin headers
  • Compression benefits
  • Purge process
  • Route-level configuration
Buy Me a Coffee