REMINDER
SOLVED Cache isn't working?
-
@thomasd hello,
- What AppDrag component are you referring to ? A website page ? A Cloud API Function ? Which method (GET/POST) ?
- How do you define the cache?
- What do you see in the response headers for the cache duration?
-
- It's a GET request, but the page uses Cloud API function to render HTML.
- It uses Query parameters, but even when they're the same (no change), there's no cache.
- What do you mean? It's only a setting under Optimize?
The headers:
Request headers:
-
Here's without Cloudflare and a page without Query Parameters:
-
Just tried with a blank page, same issue, cache only lasts a few seconds...
-
Hey Thomas,
You have not disclosed the url so I can't check... -
@jbenguira I've sent them in a PM
-
@thomasd OK I checked your url and PM
in fact caching affect only resources, not the HTML pages ...
in our setup .html files are always returned with this headercache-control: public, must-revalidate, max-age=0
but it will still be cached for a maximum of 30 seconds
FYI from a cloud function (in gateway mode) you can set any http header
including something like this
cache-control: max-age=14400Since you use Cloudflare, another option is to activate caching from there
you can do that with a "Page Rule" -
I've tried using Cloudflares pagerule "Cache everything" - but since the headers invalidate cache, Cloudflare will do the same and set pages to "Dynamic" mode.
From cloudflare:
"Whether we actually store the asset and for how long is determined by the Cache-Control headers returned with responses from the origin server"Using Edge Cache TTL makes it possible, but that disables all cookies....
This means the potential API requests for this site with 400 products and 2x languages would be 2.3M requests in 24 hours....
Can you please change the admin text for cache duration, it's very missleading if it's only for assets and not content (as the text says).
-
Hey @ThomasD , we fixed yesterday an issue with this cache option, this has bee published in production last night.
I can now see your cache duration correctly applied
Could you check again and confirm it's now all good?
-
Thanks! It's now working as I expected it to, at rocket speed
-
@joseph-benguira
Is Cache on a per-session basis?If I reload until I have "Hit from cloudfront" and then change to another browser, I'll get a "Miss from cloudfront".
Shouldn't the other browser get the Cache hit as well?
-
@thomasd no it's not based on sessions but based on headers, so different browsers will pass different user agent and so are cached differently
-
So, every new unique visitor will be served a fresh page-view, right?
-
@thomasd nop, not all headers are making the cache vary, and most users will use chrome, safari or Firefox