I have an Azure front door (afd) with a route and rule set to serve a SPA, as is quite normal, I don't want the index.html cached but do want all the other files cached. I created a rule-set and rules to specify caching policies. I also set the "Cache-Control: no-cache" metadata on the index.html in blob storage.
What am I missing? How do I setup afd so that it does not cache the index.html?
My rules looks like this:
- DisableIndexCache
- RequestPath > EndsWith > index.html
- ModifyResponseHeader > Overwrite > Cache-Control > no-cache
- Stop match processing
- DisableRootCache
- RequestPath > LessThan > 1
- ModifyResponseHeader > Overwrite > Cache-Control > no-cache
- Stop match processing
- SetDefaultCache
- ModifyResponseHeader > Overwrite > Cache-Control > max-age=86400
The afd route has caching enabled. From all the docs I have read this should work and disable caching of the index.html and root requests, but when I make a request I am still getting old cached data delivered.
curl response:
$ curl -v https://test-domain.com/
...
> GET / HTTP/2
> Host: test-domain.com
> user-agent: curl/7.68.0
> accept: */*
>
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* old SSL session ID is stale, removing
* Connection state changed (MAX_CONCURRENT_STREAMS == 128)!
< HTTP/2 200
< date: Fri, 14 Nov 2025 10:19:57 GMT
< content-type: text/html
< content-length: 7283
< last-modified: Thu, 13 Nov 2025 13:46:20 GMT
< etag: "###############"
< x-ms-request-id: ###########
< x-ms-version: 2018-03-28
< x-azure-ref: ###################
< x-cache: TCP_REMOTE_HIT
< x-fd-int-roxy-purgeid: 1
< x-cache-info: L2_T2
< accept-ranges: bytes
<
<!doctype html>
...
