Homeβ€Ί Blogβ€Ί Azure Architecture Series #99 β€” Front Door: Routing, Caching and the Rules Engine…
Azure Architecture Azure Architecture Series

Azure Architecture Series #99 β€” Front Door: Routing, Caching and the Rules Engine

Verified against current vendor documentation on 20 November 2026. Pricing, limits and API behaviour were checked against the official docs on that date. Cloud services change fast — if you are reading this much later, treat the specifics as a starting point and re-check the linked sources.

Business Challenge

The last four posts worked upward through one region: #95 and #96 at layer 4, #97 and #98 at layer 7. Front Door is what sits in front of all of them, globally, and it is a different kind of component: a content delivery network that happens to do load balancing, rather than a load balancer that happens to cache.

That inversion matters, because it puts a cache in the request path by default and makes the most consequential decision — which of Microsoft's points of presence serves a user — before the request exists.

The PoP is chosen at DNS resolution, from the resolver's location

“AFD Unicast routing determines the appropriate PoP during DNS resolution. When the end user's location isn't available from the request metadata, routing is based on the location of the DNS resolver. This condition means the request might not be routed to the PoP closest to the user.”

So a user on a corporate network whose DNS resolves centrally, or anyone using a distant public resolver, can be sent to a point of presence nowhere near them — and nothing in the request path can correct it afterwards, because by then the TCP connection is already established to that PoP's unicast address.

And one piece of housekeeping, because it is the fourth in five posts: “Azure Front Door (classic) retires on March 31, 2027. Because the service is retiring, it no longer supports profile creation, new domain onboarding, or managed certificates.” Classic is functionally frozen already, sixteen months before the date.

Architecture

Diagram: Azure Front Door request processing in four bands. The first band is the ordered pipeline a request travels. DNS resolution returns the unicast address of a chosen point of presence, and that choice is made from the end user's location when it is available and from the DNS resolver's location when it is not. The client connects directly to that address. Front Door matches the request to a profile using the Host header, performs the TLS handshake with the custom domain certificate, evaluates web application firewall rules and stops immediately if one is violated, matches the request to a route, evaluates rule sets in order, checks the cache, selects an origin within the origin group, and finally forwards to that origin. The second band is route matching, which happens in two steps and rejects rather than falls back. The frontend host must match exactly; anything else is refused with a four zero four labelled Bad Request. The path is then matched exact first, wildcard second, and refused with the same error if neither matches. A wildcard is only valid at the end of a path and must be preceded by a slash, paths without a wildcard are exact matches, and a trailing slash makes a path an exact match too, so slash path and slash path slash are different routes. Path patterns are case insensitive, which makes slash FOO and slash foo duplicates that are rejected at configuration time. Without a catch-all route, a host that matches exactly can still produce a four zero four for every path you did not enumerate. The third band is the cache. Only GET is cacheable and everything else is proxied. Large files are fetched in eight megabyte chunks with the next chunk prefetched in parallel, which requires the origin to honour byte-range requests correctly. The expiry order is s-maxage, then max-age, then Expires, and when the origin sends no Cache-Control header Front Door picks a random duration between one and three days. The ceiling is three hundred and sixty six days. Only the Last-Modified validator is supported; etag is not. The fourth band is the rules engine. Rule sets run after the firewall and before the cache lookup, in the order they appear, with rules inside each set also in order. A rule holds up to ten match conditions combined with AND and up to five actions. A rule can override the origin group the route selected, and selecting stop evaluating remaining rules halts every remaining rule set for that route.
Nine stages, two of which decide the outcome before your configuration is consulted.

The pipeline, in order

#StageThe part worth knowing
1DNS resolution returns a PoP unicast IPChosen from the resolver's location when the user's is unknown
2Client connects to that IPDirect connection; the PoP is now fixed for this connection
3Match request to a profileBy Host header; custom domains must be registered
4TLS handshakeYour certificate, or Front Door's for *.azurefd.net
5Evaluate WAF rulesA violation ends processing immediately
6Match a routeExact host, then exact path, then wildcard — or 404
7Evaluate rule setsIn order; can override the origin group the route chose
8Return cached responseAfter the rules, so rules can change the cache key and behaviour
9Select origin and forwardHealth probes, routing method, session affinity

Stage 7 before stage 8 is the ordering to internalise. The rules engine runs before the cache is consulted, which is why it can rewrite the cache key, change the cache duration, and even send the request to a different origin group than the route selected — “The origin group set by the rule set overrides the routing process”.

Route matching rejects; it does not fall back

Front Door “always matches to the most-specific request by evaluating the left-hand side properties: protocol, domain, and path, in that order”. Both the host step and the path step end the same way when nothing matches:

No match is a 404, not a default

Host: “If it doesn't find an exact match, it rejects the request with a 404: Bad Request error.” Path: exact match, then wildcard, then “reject the request with a 404: Bad Request error”.

And the trap: “If there are no routing rules for an exact-match frontend host without a catch-all route path (/*), no routing rule will be matched.”

So a host you have correctly registered, with a correctly configured route for /api/*, returns 404 for every other path on that host. The documented example makes it concrete: a profile with only /api/* answers /other with “None. Error 404: Bad Request”.

The path rules reward a careful read, because two of them are counter-intuitive:

RuleConsequence
A wildcard is “only valid for paths that don't have any other characters after it” and must be preceded by a slash/img*.png is not a thing
“A path that ends in a slash is also an exact-match path”/path and /path/ are different routes — the worked table sends them to different places
Patterns are case insensitive/FOO and /foo “are treated as duplicates and aren't allowed” — rejected at configuration time

The published matching table is worth keeping: /abzzz matches the catch-all rather than /ab; /abc/defzzz and /abc/def/ghi both match /abc/* rather than /abc/def. Prefix matching happens only through an explicit wildcard, never implicitly.

Why This Architecture Holds Up

Because caching is the feature most likely to leak data

The documentation puts a warning on this that is unusual in its directness:

Misconfiguration here is a privacy incident, not an outage

“Before you enable caching, thoroughly review the public documentation, and test all possible scenarios before enabling caching… with misconfiguration you can inadvertently cache user specific data that can be shared by multiple users resulting privacy incidents.”

The recommended structure follows from that: “have separate routes for static and dynamic assets, with caching disabled for the latter”. Two guardrails exist in the platform, and both are worth knowing precisely because people rely on them without checking:

  • Only GET is cacheable. “All other request methods are always proxied through the network.”
  • Authorized requests are excluded — conditionally. “Requests that include authorization header won't be cached, unless the response contains a Cache-Control directive that allows caching” — specifically must-revalidate, public or s-maxage. An origin that sets Cache-Control: public on an authenticated response defeats the guardrail.

There is a related subtlety on cookies: if the response is cacheable, “the Set-Cookie header is removed before the response is sent to the client”. So the platform's protection against serving one user's session cookie to another is to strip it — which silently breaks any application that expected to set a cookie on a cacheable response.

Because the default cache duration is random

One to three days, chosen for you

“If the Cache-Control header isn't present on the response from the origin, by default Front Door randomly determines a cache duration between one and three days.”

An origin that says nothing about caching does not get “no caching”, and does not get a predictable TTL either. It gets a random one, up to three days, per object. For a site whose assets are not versioned, that is the difference between a deploy taking effect now and taking effect at an unknown time within three days.

The headers that are honoured, in order, are Cache-Control: s-maxage, then Cache-Control: max-age, then Expires; and private, no-cache and no-store are respected “even if you override the caching behavior by using the Rules Engine”. The ceiling on everything is 366 days.

Because the only validator is Last-Modified

etag is not supported

“Azure Front Door uses HTTP cache validators to compare the cached version of a file with the version on the origin server. Azure Front Door supports only Last-Modified… Azure Front Door doesn't support etag.”

Most modern origins emit an ETag and many emit nothing else. Against Front Door that means every revalidation is a full fetch rather than a 304, which shows up as origin load that nobody can account for.

For large objects it gets sharper, and the named example is an Azure service:

“For content larger than 8 MB, origin backend servers should maintain consistent Last-Modified timestamps per asset. Returning inconsistent Last-Modified times from backend servers causes validator mismatch errors and results in partial file downloads or HTTP 5XX failures. Azure Storage might not support consistent Last-Modified timestamps across replicas, which can cause similar validator mismatch errors.”

Front Door in front of Blob Storage serving files over 8 MB is about as mainstream as this service gets, and the documentation says it can produce truncated downloads.

Because 8 MB is the number the cache is built around

Where 8 MB appearsBehaviour
Object chunkingFiles are fetched from the origin “in chunks of 8 MB”, with the next chunk prefetched in parallel
X-Cache headerTCP_HIT / TCP_MISS describe the first 8-MB chunk, not the whole object
Chunked Transfer Encoding origins“response sizes greater than 8 MB aren't supported”
Last-Modified consistencyRequired above 8 MB, or partial downloads and 5XX
Compression (classic)Files must be between 1 KB and 8 MB inclusive

There is no cap on file size, but there is a chunk size, and nearly every large-object caveat is a consequence of it. The chunking also depends on something the origin must get right: ranged responses must use status 206 with a Content-Range matching the actual length, “otherwise Azure Front Door doesn't cache the response, and you might see inconsistent behavior”.

And one failure that reads as a platform fault but is a content-negotiation mismatch: if byte-range requests carry Accept-Encoding and the origin answers with differing content lengths, “Azure Front Door will return a 503 error”.

Because the rules engine is ordered, conjunctive, and can stop itself

PropertyValue
Match conditions per ruleUp to 10, combined with AND
Actions per ruleUp to 5
Evaluation orderRule sets in configured order; rules within a set in their order
Early exit“Stop evaluating remaining rules” halts all remaining rule sets for the route
No match“only the default route settings get applied”
RegexSupported in conditions
Server variablesSupported in actions only
PortabilityRules “can't be exported to use across other rule sets”

Conditions are ANDed, so a rule with ten conditions fires only when all ten hold — there is no OR within a rule, and expressing alternatives means more rules, which is where the per-rule-set count starts to matter. And the asymmetry between regex-in-conditions and server-variables-in-actions is the kind of thing that costs an afternoon if you assume symmetry.

The early exit is the one with blast radius: it stops remaining rule sets, not just remaining rules. A shared security-header rule set placed last will not run for any request that triggered a stop earlier in the chain.

Because the limits are mostly generous and two of them are not

LimitStandardPremium
Profiles per subscription500500
Endpoints per profile1025
Custom domains per profile100500
Origin groups per profile100200
Origins per origin group5050
Origins per profile100200
Routes / rule sets per profile100 / 100200 / 200
Rules per rule set, per route100 / 100100 / 100
Origin timeout16 to 240 seconds
Bandwidth · requests/sec · WebSockets75 Gbps · 100,000 · 1,000,000
Header size (Private Link origin)64 KB (32 KB)
Edge actions16 KB code · 3 versions · 10 ms execution

Two rows deserve attention. Origins per profile caps at 200 on Premium while the arithmetic of 200 origin groups × 50 origins per group suggests 10,000 — the per-profile limit binds roughly fifty times earlier than the per-group one, so origin groups are cheap and origins are not. And endpoints per profile is 10 on Standard, by far the tightest number in the table and the one most likely to force a second profile.

The edge action figures are new enough to have appeared in this month's roundups — edge actions reached general availability on 10 November — and the 10 ms execution budget is the number that defines what they are for. That is not a place to call anything.

Key Architecture Decisions

DecisionChoiceWhy
Expecting users to reach their nearest PoP Don't rely on it PoP selection happens at DNS resolution and falls back to the resolver's location when the user's is unknown.
Anything on Front Door classic Migrate Retires 31 March 2027 and already refuses new profiles, new domains and managed certificates.
Route coverage Always define a catch-all /* per host Without one, every path you did not enumerate returns 404 on a host that is otherwise correctly configured.
Trailing slashes in paths Treat /path and /path/ as separate routes A path ending in a slash is an exact-match path, and the documented table routes them differently.
Caching dynamic or authenticated content Separate routes, caching off Documented as a privacy-incident risk, and the authorization-header guardrail is defeated by an origin sending Cache-Control: public.
Relying on origin cache headers Always send them explicitly With no Cache-Control, Front Door picks a random duration between one and three days, per object.
Revalidation strategy Emit Last-Modified, not just ETag Front Door supports only Last-Modified; etag is unsupported, so ETag-only origins never get a 304.
Large files from Blob Storage through Front Door Test above 8 MB before relying on it Inconsistent Last-Modified across replicas causes validator mismatches, partial downloads or 5XX — and Azure Storage is named.
Origins using Chunked Transfer Encoding Keep responses at or below 8 MB CTE responses larger than 8 MB aren't supported.
Shared rule sets placed last Audit for earlier stop conditions “Stop evaluating remaining rules” halts every remaining rule set for that route, not just the current one.
Expressing OR logic in a rule Use additional rules Match conditions within a rule are combined with AND only, capped at 10 per rule.
Scaling origins Count against origins-per-profile, not per-group 200 per profile on Premium binds roughly fifty times earlier than 200 groups Γ— 50 origins would suggest.
Standard tier for a multi-endpoint estate Check the endpoint count first 10 endpoints per profile on Standard is the tightest limit in the table.

Closing Thought

Every service in this short run has had one mechanism that decides outcomes before any of your configuration is consulted. For the load balancer it was a hash fed by traffic you do not control. For Application Gateway it was a chain where a break anywhere surfaces at the end. For Front Door it is DNS: the point of presence is chosen while resolving a name, from whatever location the platform can infer, and everything afterwards happens at whichever PoP that produced.

The second theme is that this service's defaults are tuned for a content delivery network rather than for a proxy, and the two have different instincts. A CDN caches unless told otherwise, invents a TTL when the origin is silent, strips cookies from cacheable responses, and rejects unmatched routes outright rather than passing them through. Each of those is correct for serving static assets at the edge and surprising for anyone who arrived expecting a reverse proxy with a cache bolted on.

And the one that is easiest to get wrong quietly

Only Last-Modified is supported as a validator, and etag is not. An origin that emits only an ETag — which is the modern default for most frameworks and for object storage — will never serve a 304 through Front Door. Nothing errors. The cache still works. The origin just does more work than anyone expects, permanently.

Which leaves one question for the last two posts in this sequence: with four services that all balance traffic, what actually decides which one a given workload needs.

Official Azure Reference

Comments

How was your experience?
Your feedback helps improve this site.
PoorExcellent