In AEM as a
Cloud Service, Fastly is deeply integrated into the Adobe-managed
infrastructure, and cannot be fully bypassed. However, you can control how and
what Fastly caches through HTTP headers and configuration, effectively limiting
its behavior for specific scenarios.
๐
Can Fastly Caching Be Fully Avoided?
No, Fastly is not optional in AEM as a Cloud Service—it is part of Adobe's
delivery pipeline and is always present in front of AEM Publish tiers. But you
can instruct Fastly not to cache certain content.
________________________________________
✅ How to
Prevent or Control Fastly Caching
You can minimize or bypass caching by using cache-control headers and related
strategies:
1. Use Cache-Control Headers
You can configure the response from AEM to include:
Cache-Control: no-store, no-cache, must-revalidate
OR
Cache-Control: private, max-age=0
These headers tell Fastly (and downstream CDNs like Cloudflare) not to cache
the content.
2. Set Surrogate-Control Headers
Fastly uses Surrogate-Control headers for Varnish-based caching. To explicitly
prevent Fastly from caching:
Surrogate-Control: no-store
OR
Header set Surrogate-Control "private, max-age=0, stale-if-error=0,
stale-while-revalidate=0"
In the responses, you should see always a MISS for x-cache, as this header is
set by Fastly and not Dispatcher. Also, you won't see the Surrogate-Control
header passed down.
3. Configure Dispatcher Rules
At the AEM Dispatcher level (which also sits behind Fastly), you can specify
which paths or file types should not be cached. However, Fastly may still cache
unless headers like the ones above are correctly set.
4. Use Headers for Selective Caching
You may want to cache only some parts of your site. You can do this by:
• Setting different cache TTLs (max-age) for different content
types.
• Excluding dynamic or personalized content.
5. Use Query Parameters or File Versioning
Ensure dynamic content isn’t cached due to static-looking URLs by using query
strings (e.g., ?v=123) or versioned file names.
________________________________________
๐งช
Debugging Fastly Caching
You can inspect HTTP response headers to understand Fastly’s behavior. Look
for:
• x-served-by: confirms response from Fastly
• x-cache: shows HIT or MISS
• cache-control and surrogate-control: shows cache directives
________________________________________
Summary
Can Fastly caching be completely disabled? ❌ No (not in AEM as a Cloud)
Can caching be controlled per-path or content-type?
✅ Yes
Is Fastly behavior influenced by headers?
✅
Yes (cache-control, surrogate-control)
Should you rely only on dispatcher rules? ⚠️ No, headers must align too
________________________________________
No comments:
Post a Comment