November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
Hi Johan
I've has this issue before. No matter what you set in origin response headers, Cloudflare will only cache static content. By default.
You need to contact Episerver Support and have them make a Page Rule for the /api/*
URL pattern. Then they can override the Cache Level setting, and set it to Cache Everything.
With this in place, Cloudflare will respect your origin cache headers.
I described the steps in this blog post.
Thanks! I will check with support. I know they usually aren't superhappy with custom CF config but maybe these are easier to get in place?
I know. The support is very cautios. But they were helpful when I asked a second time.
In some cases, you may need to make up a custom cache key format for the page rules. Mostly if you need to vary by cookies or custom headers (documentation page). But be careful with combinations that results in too many different variants (high cardinality).
I have confirmed that my API response has Cache-Control: public, max-age=30 but DXP environment response still says cf-cache-status DYNAMIC.
CF docs says:
Otherwise, if Cache-Control is set to public and the max-age is greater than 0, or if the Expires header is a date in the future, Cloudflare caches the resource.
If both max-age and an Expires header are set, max-age is used.
I've also read: https://world.episerver.com/documentation/developer-guides/digital-experience-platform/development-considerations/cdn-recommendations/#ConfiguringCacheHeaders
The code is similar to this example: https://stackoverflow.com/questions/15911356/setting-http-cache-control-headers-in-web-api/22620144#22620144
The method is GET, content-type is application/json and the URLs are /api/something-cool/ without querystrings.