Hi,
I’m trying to deploy CloudFront in front of Grav but not getting any CDN benefits, only cache misses.
I think it’s because Grav inserts a “Pragma: no-cache” into all rendered pages and CloudFront accepts this as “oh, best not cache then”
Is this the reason?
How do I get around it?
with kind regards,
Bent
Interesting. I just checked my sites, and all my Grav sites have the same header, but my non-Grav sites on the same host don’t. But if you look at the source code, the only time the Pragma
header is set is in the Grav\Common\Utils::download
function.
1 Like
Ended up “solving” the problem by hardcoding a minimum TTL of 3600 sec into the CDN for URLs outside /admin namespace and having TTL=0 for /admin
The CDN will then cache the content even if it has Pragma: no-cache.
But if somebody has a better solution, I would appreciate to hear about it
This seems related to https://discourse.getgrav.org/t/how-to-set-cache-control-for-images/7285