Skip to content
● Grav 2.2 is out: 2x faster cold starts and 96% less memory on big sites. Read the announcement →

Pragma: no-cache

Started by Bent Terp 8 years ago · 2 replies · 1283 views
8 years ago

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

8 years ago

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
8 years ago

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 /forum/installation-hosting/how-to-set-cache-control-for-images-t4016

last edited 08/27/18 by Bent Terp

Suggested topics

Topic Participants Replies Views Activity
Support · by gravinator, 1 month ago
5 441 15 minutes ago
Support · by stell, 7 days ago
4 235 5 days ago
Support · by Gravver, 2 weeks ago
6 278 1 week ago
Support · by Marcel, 4 weeks ago
2 337 1 week ago
Support · by blu3prince, 2 weeks ago
1 252 2 weeks ago