Where its come from, ht.access or hosting provider

caching
#1

Hi All…
My site is not getting cache by cloudflare. I use litespeed plugin for cache in my wordpress. I have checked ht.access and its seems ok.

Response Headers:

expect-ct: max-age=604800, report-uri="https ://report-uri dot cloudflarecxxx
status: 200
strict-transport-security: max-age=15552000; includeSubDomains; preload
x-content-type-options: nosniff
content-encoding: br
cf-cache-status: MISS
expires: Fri, 05 Apr 2019 02:20:00 GMT
vary: Accept-Encoding
server: cloudflare
last-modified: Mon, 21 Aug 2017 17:12:59 GMT
x-turbo-charged-by: LiteSpeed
cache-control: no-cache
date: Fri, 05 Apr 2019 02:20:01 GMT
cf-ray: 4c2xxxxx
content-type: text/css
:status: 200

Is that posible server side overwrite my ht.aceess? How to fix it.
Thank you…

#2

This is the problem. You’ll need to look into why cache-control is no-cache, or you may want to contact your hosting provider.

1 Like
#3

It looks like that resource is set to expire at the same time it’s delivered.

#4

My provider Customer Service said that I must look into my site setting or CF settng. He said “Server has set normal”…

How to check server side header cache?

========================================
Here is my ht.access created by LScache plugin

#. BEGIN LSCACHE
##. LITESPEED WP CACHE PLUGIN - Do not edit the contents of this block! ##.

RewriteEngine on
CacheLookup on
RewriteRule .* - [E=Cache-Control:no-autoflush]
RewriteRule ^min/\w+.(css|js) - [E=cache-control:no-vary]

.### marker CACHE RESOURCE start ###.
RewriteRule wp-content/./[^/](responsive|css|js|dynamic|loader|fonts).php -
[E=cache-control:max-age=3600]
.### marker CACHE RESOURCE end ###.

.### marker FAVICON start ###.
RewriteRule favicon.ico$ - [E=cache-control:max-age=86400]
.### marker FAVICON end ###

And some code…

=================================

Spend couple of weeks to solve this. Realy need help

#5

Cloudflare cache settings are on the Cache page, or in a Page Rule, but they don’t zero out cache times.

You can test your origin server’s response manually:
curl -svo /dev/null --resolve example.com:80:123.123.123.123 http://example.com/

Replace example.com with your actual hostname, and the 123. address with your web server’s real IP address.

#6

Here is what I check from redbot

omunity

Is something wrong there?

#7

Cache-Control is anti-cache: Zero max-age, no-cache, no-store. Expires way in the past.

This all comes from your server and has nothing to do with Cloudflare.

#8

Ah I see.
I am still comunication with the hosting provider. Because there is no seting like this on my ht.accesss.

Is clouflare has hosting service and doman service?

#9

Cloudflare only proxies (like an enhanced firewall) your site. Cloudflare is also a domain registrar if you’d like to transfer your domain registration over here. But no hosting.

#10

Besides .htaccess, your WordPress caching plugin may be adding these headers. Check to see if your caching plugin is enabled (some cache plugins will be initially disabled after you activate them, waiting for you to enable it after adjusting its settings), and look for special settings like “do not cache known users”, or “do not cache home page”.

1 Like
#11

Thank you floripare

  1. I will disable cache plugin and delete it.
  2. Delete all cache directive from ht.acesss
  3. Purge cache and pause cloudflare
  4. Change NS back to Origin server
  5. Do some test again…

Am I right?

Lets see what the result
Thank you for your help…

#12

Actually, it’s my experience that WordPress by default will send a Cache-Control: no-cache or similar header in a standard installation. It’s the job of your cache plugin, after proper configuration, to change that according to the settings you chose. So I’d suggest you keep your caching plugin, but go through it’s setting page(s) and make sure you fine tune it to cache your dynamic pages (I’m assuming you want that).

Many settings will be a matter or trial and error, until you get satisfied with the results. Always remember to flush the cache of both the plugin and Cloudflare every time you change settings.

1 Like
#13

Thank you… I realy don’t know right now. Where is no chache or wrong cache directive makes CF not caching my site…

Hi…
sdayman
loripare

Here is some details.

Plugin setting

ht.acess
HT%20acces

Respon by redorg

Respon from chrome


So where I can find cache header control.?
Thank you for your help

#14

I guess that you should avoid using this LiteSpeed plugin as its basically for LiteSpeed server only. If you want to use a plugin then better go with Cloudflare official cache plugin and make these settings:

You can change the Browser Cache Expiration either to no. of hours or let it Respect Existing Headers

#15

Also another problem is with the url ended with ?ver=5.1.1 , these appended query strings does not cache the content often. There exists plugin that remove these query strings from the end of url. You should check for other css, js, images url on same page if they are caching or not.

#16

If WPFasterCache has added those lines in .htaccess then you should check its settings to avoid it or remove it manually from .htaccess.

#17

I use WP Fastest Cache, and it’s not setting those headers. Here are my settings:

I let Cloudflare handle the minifying and gzip. I really just use it for the page caching. I’m not even sure why I enabled Browser Caching because I set that in my Cloudflare Caching settings page.

There’s also the chance it’s something set in your Hosting configuration. But it’s clearly not set by Cloudflare.

1 Like
#18

If the Cache-Control header is set to “private”, “no-store”, “no-cache”, or “max-age=0”, or if there is a cookie in the response, then Cloudflare will not cache the resource, unless a Page Rule is set to cache everything and an Edge Cache TTL is set.

The above explanation is from the Cache app help page. You must ensure that the Edge Cache TTL is set on the same page rule that defines “cache everything”.

So you need to have a few page rules, to make sure your wp-admin area is never cached, and to cache everything else, and place them in the following order:

1st page rule
*example.com/wp-admin*
Settings:
Cache Level: Bypass
Disable Apps
Disable Performance
Security Level: High

Then a second page rule:
*example.com/*
Cache Level: Cache Everything
Edge Cache TTL: a month
Browser Cache TTL: a day (optional)

If you have plugins that depend on accessing /wp-json/, you may have to add another rule between them. Same settings as the first rule, but for
*example.com/wp-json*

1 Like