Cache rules control which content is eligible for caching at the eCDN edge, and cache purge selectively invalidates cached content by tag or path. Both capabilities are available in Business Manager for your B2C Commerce storefront.
Which Salesforce Commerce Product Do I Have?
Use cache rules to control which content is eligible for caching at the eCDN edge. By default, eCDN caches only static content based on file extension and doesn't cache HTML pages or JSON responses. Cache rules make HTML pages and JSON responses eligible for edge caching, which is a prerequisite for using cache purge by specific tags or paths.
Use cache purge to selectively invalidate cached content by cache tag or path directly from Business Manager, using the Purge Cache button.
Cache-Control (or
Expires) response headers for eligible content to be cached.
To configure cache rules and purge the cache, in Business Manager, go to , and then select Configure Zone for the zone that you want. Cache rules and the Purge Cache button are available at zone scope for these zone types.
| Zone Type | Instance Group | Cache Rules | Cache Purge |
|---|---|---|---|
| Storefront zones | PIG (production, staging, and development) | Available | Available |
| Default zones | PIG | Available | Available |
| ODS Default zones | SIG (On-Demand Sandboxes) | Available | Available |
| SCAPI zones | — | Not Available | Available on Production (tag and path) |
Purge Cache for SCAPI Zones
For B2C Commerce SCAPI zones, only cache purge is available, and only from the Production instance. Cache rules aren't supported. There's one SCAPI zone for Development, Staging, and Production. The zone doesn't appear in Business Manager or the CDN API on Development or Staging. For the full SCAPI zone control matrix, see SCAPI Zone Support for B2C Commerce.
- SCAPI caching is a platform-managed capability. To prevent changes to SCAPI caching behavior, cache-rule self-service is disabled for these zones.
- You can't define tags for SCAPI. SCAPI sets cache tags automatically when a response is cached.
- B2C Commerce synchronizes SCAPI cache invalidation automatically.
- Purge SCAPI zone content by tag or by path from the Production instance.
How B2C Commerce eCDN Decides What to Cache
By default, when no cache rules are configured, eCDN caches by file extension only. Common
static extensions (images, JS, CSS, fonts, video, documents, and archives) are cached. eCDN
doesn't cache HTML, JSON, XML, or TXT responses by default (except robots.txt).
The maximum cacheable object size is 5 GB.
A response is cached only when all of these conditions are true.
- The request method is GET.
- The response has no
Set-Cookieheader. - The response has
Cache-Control: publicwithmax-age > 0, or a futureExpiresdate. When multiple values are present, the precedence iss-maxage, thenmax-age, thenExpires.
A response isn't cached if any of these conditions are true.
Cache-Controlisprivate,no-store,no-cache, ormax-age=0.- No
Cache-Controlheader is present. - A
Set-Cookieheader is present. - The request method isn't GET.
Best Practices for B2C Commerce eCDN Caching
- Cache HTML and JSON deliberately. Make dynamic content eligible only where the response
is genuinely shared across shoppers and safe to cache. Never cache personalized or
authenticated responses. Make sure that those responses carry
Set-CookieorCache-Control: private. - Use cache tags for coordinated invalidation. Stamp related content with shared tags (for example, by product, category, or content asset) so that you can purge a logical group in one request instead of listing paths.
- Exclude tracking parameters from the cache key (for example,
gclidandutm_campaign) to maximize the cache hit ratio. - Verify caching with the
Cf-Cache-Statusresponse header. A value ofHITconfirms edge caching. A value ofMISSorDYNAMICindicates that the content wasn't served from cache. - Test in a sandbox first. ODS Default zones support cache rules and purge, so you can validate rule behavior on a sandbox before you apply it to production.
Troubleshooting B2C Commerce eCDN Caching
If eCDN isn't caching content as expected, check for these issues.
- Origin headers: Confirm that the response sends
Cache-Control: public, max-age>0(or a futureExpires). Set-Cookie: Remove theSet-Cookieheader from cacheable responses. It suppresses caching.- Request method: Confirm that the request uses
GET. eCDN caches onlyGETrequests. - Expression accuracy: Confirm that the rule expression matches the request path/extension.
- Rule enabled: Confirm that the rule's Enabled flag is on.
Cf-Cache-Statusheader: Check this header to see whether the edge served the response from cache.HITmeans it did.MISS/DYNAMICmeans it didn't.
- Create an eCDN Cache Rule
Create a cache rule to make HTML pages and JSON responses eligible for caching at the eCDN edge for your B2C Commerce storefront. By default, eCDN caches only static content based on file extension. - Purge the eCDN Cache
Selectively invalidate content in the B2C Commerce eCDN cache by cache tag or path directly from Business Manager.