Jump to content

CloudFlare settings


Recommended Posts

6 minutes ago, marklcfc said:

Just viewed the site as a guest from default 4.7 skin and its the same

 

Could contain: Text, Computer Hardware, Hardware, Electronics, Screen, Monitor

Same with all third party hooks and apps disabled

Unfortunately, that means you're back on your server is overriding these headers on you for this then.

Link to comment
Share on other sites

Remember...  there IS value.  Even if the base page itself is not served from a cache, all of the other content.... images, stylesheets, and JavaScripts ARE being cached.  

That's the heaviest weight of any page.  The base page itself is a few KB whereas the rest of the content is in the MB in total.  

Link to comment
Share on other sites

@marklcfc - I think you're actually only one step away from getting it working. The flow of the caching system in cloudflare is as follows:

Could contain: Page, Text, Number, Symbol, Mobile Phone, Phone, Electronics

While you've set up your rules for when not to cache, you've not actually told it when and what to cache. For that, you need to make a page rule for your url - with a wildcard, so it happens on every page. (eg https://www.foxestalk.co.uk/*)

Then you need to select cache level and chose cache everything. 

Could contain: Page, Text, File

Then once you've saved it, give it 30 seconds and you should have a fully working page cache for guests.

Edited by Dll
Link to comment
Share on other sites

Then I'd say it is as has been explained above - something else is setting the cache-control header which is over-riding the cloudflare side. You need to find what that is - it's highly likely something your host would need to change. 

I'd recommend adding a / to the beginning of your uri rules on in the cache rule section as well, just in case not having them is causing a problem with it. 

Link to comment
Share on other sites

3 hours ago, Dll said:

@marklcfc - I think you're actually only one step away from getting it working. The flow of the caching system in cloudflare is as follows:

Could contain: Page, Text, Number, Symbol, Mobile Phone, Phone, Electronics

While you've set up your rules for when not to cache, you've not actually told it when and what to cache. For that, you need to make a page rule for your url - with a wildcard, so it happens on every page. (eg https://www.foxestalk.co.uk/*)

Then you need to select cache level and chose cache everything. 

Could contain: Page, Text, File

Then once you've saved it, give it 30 seconds and you should have a fully working page cache for guests.

Just as a heads up, the cache rules are saying not to cache "these" but cache everything else 🙂 . Just want to clarify that so there is no confusion.

Link to comment
Share on other sites

47 minutes ago, Jim M said:

Just as a heads up, the cache rules are saying not to cache "these" but cache everything else 🙂 . Just want to clarify that so there is no confusion.

I don't think they are for this use case though, as unless you tell cloudflare otherwise it won't cache html, which is what you're wanting it to do in this instance, I think? That needs a page rule to set it to cache everything. The cache rules is just about cache eligibility of the assets being loaded rather than specifically saying 'cache everything else', so won't over-ride the fact that html isn't cached.  (As far as I understand it)

https://support.cloudflare.com/hc/en-us/articles/360021023712-Best-Practices-Speed-up-your-Site-with-Custom-Caching-via-Cloudflare-Page-Rules

Quote

Cloudflare does not cache HTML resources automatically. This prevents us from unintentionally caching pages that often contain dynamic elements. For example, the content on certain HTML pages may change based on specific visitor characteristics, such as authentication, personalization, and shopping cart information.

 

Edited by Dll
Link to comment
Share on other sites

Just now, Dll said:

I don't think they are for this use case though, as unless you tell cloudflare otherwise it won't cache html, which is what you're wanting it to do in this instance, I think? That needs a page rule to set it to cache everything. The cache rules is just about cache eligibility of the assets being loaded rather than specifically saying 'cache everything else', so won't over-ride the fact that html isn't cached.  (As far as I understand it)

https://support.cloudflare.com/hc/en-us/articles/360021023712-Best-Practices-Speed-up-your-Site-with-Custom-Caching-via-Cloudflare-Page-Rules

 

Cache Rules are different than Page Rules.

Link to comment
Share on other sites

5 minutes ago, Jim M said:

Cache Rules are different than Page Rules.

You're right. I thought they were used in combination with eachother, but looking at the docs, it is the equivalent of telling it to cache everything. 

Quote

Be aware that when you select Eligible for cache in Cache Rules, this is equivalent to cache everything cache level. If you do not enable eligible for cache, the expected behavior is the standard cache level present in Page Rules.

 

Link to comment
Share on other sites

Hi @Jim M

I was looking at that Expires: 0 header. Is it something to do with the session cookie that IPS sets? When I close the browser leaving marklfc's site open, and then reopen it so that it reloads the previously open tabs (my current preference), the session cookie is preserved and still present (Chrome bug lists this as a feature and not a bug btw), and the header includes expires: 0.

Firefox Devtools cookie view:

ips4_IPSSessionFront:"j326nroc689ghbtk3ak9rnpg73"
Created:"Mon, 14 Nov 2022 14:37:53 GMT"
Domain:"www.foxestalk.co.uk"
Expires / Max-Age:"Session"
HostOnly:true
HttpOnly:true
Last Accessed:"Mon, 14 Nov 2022 14:37:53 GMT"
Path:"/"
SameSite:"None"
Secure:true
Size:46

@marklcfc

Just for info I just looked at your test page and after a couple of refreshes it showed a cache hit for me, but your forum still doesn't.

Could contain: Page, Text, Monitor, Computer Hardware, Screen, Hardware, Electronics

 

Edit: If I turn off the option to resume open tabs, the session is correctly not preserved as you would expect.

Quote

HTTP/1.1 200 OK
date: Mon, 14 Nov 2022 15:04:08 GMT
content-type: text/html;charset=UTF-8
x-ips-loggedin: 0
vary: Cookie,Accept-Encoding
x-xss-protection: 0
x-frame-options: sameorigin
content-security-policy: frame-ancestors 'self', upgrade-insecure-requests
x-content-security-policy: frame-ancestors 'self'
referrer-policy: strict-origin-when-cross-origin
expires: 0
cache-control: no-cache, no-store, must-revalidate, max-age=0, s-maxage=0
x-powered-by: NIMHOST
x-served-by: 285d64a569e78a3aa198e0e800e3432e
cf-cache-status: BYPASS
report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=ViQtVInaZ6OfWIYR%2BEg1KOOvEdid6zInqEODuHz1uHi%2B%2FLTIr72Wd8k%2B1D7W9JQroXN3lZGBTghm8QXn1Nb2axLydLtAP12h%2FsMmqz8a2%2BUS6hXyWhd8QwnxsvndUiVZ91GWXF0Av9HCASyyaXKLdVk%3D"}],"group":"cf-nel","max_age":604800}
nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
server: cloudflare
cf-ray: 76a0a34a3dee5499-MAN
content-encoding: br
X-Firefox-Spdy: h2

Could contain: Text

 

 

Edited by The Old Man
Tested with and without reopen tabs
Link to comment
Share on other sites

10 minutes ago, The Old Man said:

I was looking at that Expires: 0 header. Is it something to do with the session cookie that IPS sets? When I close the browser leaving marklfc's site open, and then reopen it so that it reloads the previously open tabs (my current preference), the session cookie is preserved and still present (Chrome bug lists this as a feature and not a bug btw), and the header includes expires: 0.

The expires header and cache-control header would work in conjunction. If no-cache, etc... is set then expires will be 0. There is something on marklfc's server or otherwise which is overriding the cache-control header and thus causing the issues being seen.

Link to comment
Share on other sites

29 minutes ago, The Old Man said:

Just for info I just looked at your test page and after a couple of refreshes it showed a cache hit for me, but your forum still doesn't.

I give up, clearly not meant to be there's always something and its impossible for me to fix, hosts just say contact Cloudflare about it even though when I bypass Cloudflare it remains the same.

May as well delete the cache rules if they're not doing anything.

Edited by marklcfc
Link to comment
Share on other sites

There is a value even if the base page is not cached.  For example, I just opened one of your forums randomly...

Could contain: Page, Text

The browser loaded 170 objects.  Over 90% of them were delivered from the CDN cache.  That means with me sitting in the US, over 150 objects never had to go to the origin which I assume is in the UK to get those objects.  It also meant of the 6MB worth of data that I needed to download...  your web server only had to deliver a few KB of content instead of several MB.  

So it has a lot of value in terms of end user perspective AND it helps reduce the amount of content your server itself needs to deliver.  It's not just the page (which is one of the smallest things to deliver)...  it's all of the associated content that the page loads that matters as well.  

Link to comment
Share on other sites

2 hours ago, Randy Calvert said:

The browser loaded 170 objects.  Over 90% of them were delivered from the CDN cache.

I assume that will still be the case if I turn off the cache rules which are seemingly not working?

also does it load fast for you? Someone in North Carolina said it was really quick for him, I imagine it must have been quite sluggish previously to notice a big difference now

Edited by marklcfc
Link to comment
Share on other sites

6 hours ago, marklcfc said:

I assume that will still be the case if I turn off the cache rules which are seemingly not working?

also does it load fast for you? Someone in North Carolina said it was really quick for him, I imagine it must have been quite sluggish previously to notice a big difference now

That is still part of the cache rules which you’re seeing there…

Link to comment
Share on other sites

Hi @marklcfc

When you get a min, please could you take a quick look in your constants.php file, if you have one?

I found a line I was unaware of in one of mine that was causing issues, which I think was added when I replaced the constants file after I deactivated Redis page caching (ye old IPS version) prior to upgrading to the latest/current version:

\define( 'CACHE_PAGE_TIMEOUT', 0 );

On this particular site, the guest caching was always in BYPASS mode and showing different to my other sites, I couldnt figure out why:

cache-control	no-cache, no-store, must-revalidate, max-age=0, s-maxage=0
expires 0
vary	Cookie,Accept-Encoding

 

After removing it, and clearing all cookies for the site from my browser (I couldn't log out and I had a complaint someone couldn't check out of my Commerce store), I am now seeing the new rule:

cache-control
	no-cache="Set-Cookie", max-age=900, public, s-maxage=900, stale-while-revalidate, stale-if-error
HIT
Expires Wed, 16 Nov 2022 18:11:31 GMT

My other sites cache differently, but not like this:

Site P - Guest HITS (has IPS Gallery and Pages)

cache-control	no-cache="Set-Cookie", max-age=900, public, s-maxage=900, stale-while-revalidate, stale-if-error
expires	Mon, 14 Nov 2022 20:44:32 GMT
vary	Cookie,Accept-Encoding

 

Site M - Guest HITS (has all IPS except Blogs and Commerce, and in a subfolder part of HTML/PHP site)

cache-control	no-cache="Set-Cookie", max-age=900, public, s-maxage=900, stale-while-revalidate, stale-if-error
expires	Mon, 14 Nov 2022 20:54:06 GMT
vary	Cookie,Accept-Encoding

 

Site S - Guest HITS (has IPS Gallery only in a subfolder of Wordpress) 

cache-control	no-cache="Set-Cookie", max-age=3600, public, s-maxage=3600, stale-while-revalidate, stale-if-error
expires	Mon, 14 Nov 2022 21:28:13 GMT
vary	Cookie,Accept-Encoding

 

Site I - Guest BYPASS only (has full IPS suite & the rogue constants rule)
cache-control	no-cache, no-store, must-revalidate, max-age=0, s-maxage=0
expires 0
vary	Cookie,Accept-Encoding

now after deleting that rule:

HIT
cache-control	no-cache="Set-Cookie", max-age=900, public, s-maxage=900, stale-while-revalidate, stale-if-error
expires Wed, 16 Nov 2022 18:11:31 GMT
vary	Cookie,Accept-Encoding

 

For my sites in subfolders, I did remember to adjust the Caching Rule paths accordingly with the folder name.

Many thanks.

Link to comment
Share on other sites

Yes @The Old Man mine has that line, Redis is currently active as well its one of those along with opcache I wasn't sure whether to keep installed or not.

It looks like this

<?php


\define( 'REDIS_ENABLED', true );
\define( 'STORE_METHOD', 'Redis' );
\define( 'STORE_CONFIG', '[]' );
\define( 'CACHE_METHOD', 'Redis' );
\define( 'REDIS_CONFIG', '{"server":"127.0.0.1","port":6379,"password":""}' );
\define( 'CACHE_PAGE_TIMEOUT', 0 );
\define( 'SUITE_UNIQUE_KEY', 'removedthis' );


 

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...