Very slow first load when cache is activated

Hello,
I’ve set up Cloudflare for my domain and immediately noticed the slow initial loading time presumably because static content is served from Cloudflare’s servers. If I enable development mode bypassing cache the website loads 4 times faster (12.7s vs 3.58s). Is this some sort of limitation for free accounts? At this point I see no reason to use the cache as it’s only annoying, >12s (often closer to 20) load time is more than enough to presume the website is down and leave it altogether.

That’s a ton of JS files that aren’t being cached. Any resource that’s not cached by Cloudflare takes an additional hop for Cloudflare to get it from your server. The cache-control header says “public” but has no expiration set. It seems to me that’s why they’re not being cached. If you can add a max-age to that header, it should speed things up considerably.

https://support.cloudflare.com/hc/en-us/articles/115003206852-Enabling-Origin-Cache-Control-with-Cloudflare-Page-Rules

2 Likes

You were right, thanks, I’ve added
Cache-Control: public, max-age=691200, s-maxage=691200
to my load balancer and purged cache in cloudflare, it now loads around 3 seconds with cache enabled :slight_smile:

2 Likes

This topic was automatically closed after 30 days. New replies are no longer allowed.