Cloudflare breaks page layout (over time)

Every three or four days, the layout on my site breaks. I’m using WordPress, Litespeed Cache, and Cloudflare. When this happens, I flush the Litespeed cache, but it does not correct it. The only thing that corrects it is to clear the Cloudflare cache. Can anybody point me in the right direction for eliminating this issue?

I don’t think Litespeed Cache is part of the problem, as that’s just HTML. I’ve run into the same thing, and it’s because my Cloudflare cache was set to too long. CSS and/or JS would change, so the site would request a file that no longer existed. But I have to admit, I do purge all LiteSpeed cache every 12 hours, then re-crawl.

Do you have any Page Rules?

Yes, I’m using a page rule to forward non ssl requests to https (301 redirect).

Well, that wouldn’t be the cause.

I’m honestly surprised and impressed that your cached resources here last three or four days. You must have a pretty decent cache hit ratio.

Try a Page Rule to match:
https://example.com/*
And a setting of Edge Cache TTL of 1 day.

Though I suspect that there may be a chance of just missing the cutoff when a file changes that will still break your layout.

Do you have APO and the Cloudflare plugin?

I’m curious as to exactly which file(s) are causing the problems. Something is telling the browser to request a file that no longer exists.

Yes, I do have APO turned on.

I was checking with one of my other sites that hasn’t had this problem, and I noticed this setting in Litespeed:

“CCSS per URL: Disable this option to generate CCSS per Post Type instead of per page. This can save significant CCSS quota, however it may result in incorrect CSS styling if your site uses a page builder.”

I had that set to OFF on the site I’m having problems with. Could that have been the cause?

You can certainly try changing that.

Adding the Page Rule to change Edge Cache TTL might also help since you’re using APO.

I will try both. Thank you!

1 Like

So far, so good. Thanks again, sdayman.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.