• Hello,

    I tried your extension as I read great stuff about it, however I am having troubles making it work.

    Just after activating the caching, I click on test cache, I get “Page caching is working properly”.

    But, if I go to my home page, and look at the headers (Inspect Element > Network), I see :

    Cache-Control: no-store, no-cache, must-revalidate, max-age=0
    Pragma: no-cache
    X-WP-CF-Super-Cache: no-cache
    X-WP-CF-Super-Cache-Cache-Control: no-store, no-cache, must-revalidate, max-age=0

    but doing so in incognito, I get :

    X-WP-CF-Super-Cache: cache
    X-WP-CF-Super-Cache-Active: 1
    X-WP-CF-Super-Cache-Cache-Control: s-maxage=31536000, max-age=60
    X-WP-CF-Super-Cache-Cookies-Bypass: swfpc-feature-not-enabled

    1) I have WooCommerce installed, so I wonder, when my users will make a purchase, they will be logged in, so they wont benefit from the caching anymore ?

    2) Also, is it relevant to have the Cloudflare extension along with yours or is it redundant ?

    3) So now, I wonder, what could I do here ? how could I test easily if the extension is working ? Indeed, even in incognito, the images/css/js don’t seem to be cached (I see “Cache-Control: no-cache”), so I am not sure how to know if I did something wrong.

    For information:
    my install is on a subfolder (not subdomain) : https://domainlink.com/test/
    I have full access to apache and php config, and activated opcache.
    attached is my htaccess, and the log from the extension :

    
    [2021-01-09 23:21:03] [cloudflare::get_cloudflare_cookie] Cookies found: Array
    (
        [0] => WP_Http_Cookie Object
            (
                [name] => __cfduid
                [value] => da0f5d8c870b2a832fd88bb49221fbe961610234459
                [expires] => 1612826459
                [path] => /
                [domain] => domainlink.com
                [host_only] => 
            )
    
    )
    
    [2021-01-09 23:21:03] [cloudflare::page_cache_test] Start test to https://domainlink.com/test with headers Array
    (
        [timeout] => 10
        [sslverify] => 
        [user-agent] => Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0
        [headers] => Array
            (
                [Accept] => text/html
                [cookie] => __cfduid=da0f5d8c870b2a832fd88bb49221fbe961610234459
            )
    
    )
    
    [2021-01-09 23:21:04] [cloudflare::page_cache_test] Response Headers: Requests_Utility_CaseInsensitiveDictionary::__set_state(array(
       'data' => 
      array (
        'date' => 'Sat, 09 Jan 2021 23:21:04 GMT',
        'content-type' => 'text/html; charset=UTF-8',
        'x-powered-by' => 
        array (
          0 => 'PHP/7.4.13',
          1 => 'PleskLin',
        ),
        'cf-edge-cache' => 'cache,platform=wordpress',
        'cache-control' => 
        array (
          0 => 's-maxage=31536000, max-age=60',
          1 => 'private, must-revalidate',
        ),
        'x-wp-cf-super-cache' => 'cache',
        'x-wp-cf-super-cache-active' => '1',
        'x-wp-cf-super-cache-cache-control' => 's-maxage=31536000, max-age=60',
        'x-wp-cf-super-cache-cookies-bypass' => 'swfpc-feature-not-enabled',
        'link' => '<>; rel=preload; as=style, <>; rel=preload; as=style, <>; rel=preload; as=style, <>; rel=preload; as=style, <>; rel=preload; as=style, <>; rel=preload; as=style, <>; rel=preload; as=style, <>; rel=preload; as=style, <>; rel=preload; as=style, <>; rel=preload; as=style, <>; rel=preload; as=style, <>; rel=preload; as=style, <>; rel=preload; as=style, <>; rel=preload; as=style, <>; rel=preload; as=style, </test/wp-content/mmr/18401fbb-1609953611.css>; rel=preload; as=style, <>; rel=preload; as=style, <>; rel=preload; as=style, <>; rel=preload; as=style, <>; rel=preload; as=style, <>; rel=preload; as=style, <>; rel=preload; as=style, <>; rel=preload; as=style, </test/wp-content/mmr/286d1d88-1609954526.css>; rel=preload; as=style, </test/wp-content/mmr/bf45127f-1610223891.css>; rel=preload; as=style, </test/wp-content/mmr/52441598-1605778273.js>; rel=preload; as=script, <>; rel=preload; as=script, <>; rel=preload; as=script, <>; rel=preload; as=script, <>; rel=preload; as=script, <>; rel=preload; as=script, <>; rel=preload; as=script, <>; rel=preload; as=script, <>; rel=preload; as=script, </test/wp-content/mmr/deb92502-1609953608.js>; rel=preload; as=script, <>; rel=preload; as=script, <>; rel=preload; as=script, <>; rel=preload; as=script, <>; rel=preload; as=script, <>; rel=preload; as=script, </test/wp-content/mmr/c4e71b87-1610223892.js>; rel=preload; as=script',
        'x-frame-options' => 'SAMEORIGIN',
        'vary' => 'Accept-Encoding',
        'expires' => 'Mon, 08 Feb 2021 23:21:03 GMT',
        'x-xss-protection' => '1; mode=block',
        'x-content-type-options' => 'nosniff',
        'cf-cache-status' => 'BYPASS',
        'cf-request-id' => '078b0d1dbe0000c550d0917000000001',
        'expect-ct' => 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"',
        'report-to' => '{"endpoints":[{"url":"https:\\/\\/a.nel.cloudflare.com\\/report?s=%2FlI5bD4LZFNuEgWamndX5CTlUWcxICzshoYcSNfo9ZxCnQ%2FIVYnFNjkaLTMKzX9xqm3bUlongv8EZGHIwSrPW2ufaAS1NCOKMQbPT411ZvY5iw%3D%3D"}],"group":"cf-nel","max_age":604800}',
        'nel' => '{"report_to":"cf-nel","max_age":604800}',
        'server' => 'cloudflare',
        'cf-ray' => '60f1e475f9eac550-ORD',
        'content-encoding' => 'gzip',
      ),
    ))
    [2021-01-09 23:21:05] [cloudflare::get_cloudflare_cookie] Cookies found: Array
    (
        [0] => WP_Http_Cookie Object
            (
                [name] => __cfduid
                [value] => d626af1670daee6fe05e8616f9d4f54731610234464
                [expires] => 1612826464
                [path] => /
                [domain] => domainlink.com
                [host_only] => 
            )
    
    )
    
    [2021-01-09 23:21:05] [cloudflare::page_cache_test] Start test to https://domainlink.com/test/wp-content/plugins/wp-cloudflare-page-cache/assets/testcache.html with headers Array
    (
        [timeout] => 10
        [sslverify] => 
        [user-agent] => Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0
        [headers] => Array
            (
                [Accept] => text/html
                [cookie] => __cfduid=d626af1670daee6fe05e8616f9d4f54731610234464
            )
    
    )
    
    [2021-01-09 23:21:05] [cloudflare::page_cache_test] Response Headers: Requests_Utility_CaseInsensitiveDictionary::__set_state(array(
       'data' => 
      array (
        'date' => 'Sat, 09 Jan 2021 23:21:05 GMT',
        'content-type' => 'text/html; charset=UTF-8',
        'x-frame-options' => 'SAMEORIGIN',
        'last-modified' => 'Fri, 08 Jan 2021 22:37:32 GMT',
        'vary' => 'Accept-Encoding',
        'cache-control' => 'private, must-revalidate',
        'expires' => 'Mon, 08 Feb 2021 23:21:05 GMT',
        'x-powered-by' => 'PleskLin',
        'x-xss-protection' => '1; mode=block',
        'x-content-type-options' => 'nosniff',
        'cf-cache-status' => 'BYPASS',
        'cf-request-id' => '078b0d23a40000a2a39e107000000001',
        'expect-ct' => 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"',
        'report-to' => '{"endpoints":[{"url":"https:\\/\\/a.nel.cloudflare.com\\/report?s=pe0GMQ1A%2FKLakM2xbRaSgb1qrCskj%2FBzpH1QFVCxT0LBncSUylva%2FzMEA3TDezjUn%2FESPxDvp1kZZ2sc6jPvYl8DCns3iLQGUFmxpmy05dexAQ%3D%3D"}],"group":"cf-nel","max_age":604800}',
        'nel' => '{"report_to":"cf-nel","max_age":604800}',
        'server' => 'cloudflare',
        'cf-ray' => '60f1e47f680ea2a3-ORD',
        'content-encoding' => 'gzip',
      ),
    )) 
    
    
    <IfModule mod_mime.c>
    AddType image/webp .webp
    </IfModule>
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP_ACCEPT} image/webp
    RewriteCond %{REQUEST_FILENAME} "/wp-content/"
    RewriteCond %{REQUEST_FILENAME} "\.(jpg|jpeg|gif|png)$"
    RewriteCond %{REQUEST_FILENAME}\.webp -f
    RewriteRule ^(.+)$ $1\.webp [NC,T=image/webp,E=webp,L]
    </IfModule>
    
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteBase /test/
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /test/index.php [L]
    </IfModule>
    
    <ifModule mod_headers.c>
    <filesMatch "\.(ico|jpeg|jpg|png|gif|swf|pdf|svg)$">
    Header set Cache-Control "public"
    </filesMatch>
    <filesMatch "\.(css)$">
    Header set Cache-Control "public"
    </filesMatch>
    <filesMatch "\.(js)$">
    Header set Cache-Control "private"
    </filesMatch>
    <filesMatch "\.(x?html?|php)$">
    Header set Cache-Control "private, must-revalidate"
    </filesMatch>
    </ifModule>
    
    FileETag None
    
    Options -Indexes
    <IfModule dir_module>
    	DirectoryIndex disabled
    	DirectoryIndex index.php
    </IfModule>
    
    AddDefaultCharset UTF-8
    
    <IfModule mod_headers.c>
    	<FilesMatch "\.(css|js|gz|xml)$">
    		Header append Vary: Accept-Encoding
    	</FilesMatch>
    </IfModule>
    
    <IfModule mod_headers.c>
    	Header set X-XSS-Protection "1; mode=block"
    	Header always append X-Frame-Options SAMEORIGIN
    	Header set X-Content-Type-Options nosniff
    </IfModule>
    
    <FilesMatch "^(wp-config.php|license.txt|readme.html)">
    	Order Allow,Deny
    	Deny from all
    </FilesMatch>
    
    <IfModule mod_expires.c>
    	ExpiresActive on
    	ExpiresDefault "access plus 1 month"
    	#
    	ExpiresByType image/jpg  "access plus 1 year"
    	ExpiresByType image/jpeg "access plus 1 year"
    	ExpiresByType image/gif  "access plus 1 year"
    	ExpiresByType image/png  "access plus 1 year"
    	ExpiresByType text/css   "access plus 1 month"
    	#
    	ExpiresByType text/javascript        "access plus 1 month"
    	ExpiresByType application/javascript "access plus 1 month"
    	ExpiresByType text/x-javascript      "access plus 1 month"
    	#
    	ExpiresByType image/x-icon "access plus 1 year"
    </IfModule>
    
    <IfModule mod_deflate.c>
    	AddOutputFilter       DEFLATE css js
    	AddOutputFilterByType DEFLATE image/svg+xml image/x-icon
    	AddOutputFilterByType DEFLATE application/vnd.ms-fontobject application/x-font-ttf font/opentype
    	AddOutputFilterByType DEFLATE application/javascript application/x-javascript text/javascript text/x-js
    	AddOutputFilterByType DEFLATE text/html text/plain text/richtext text/css application/json text/xsd text/xsl
    	AddOutputFilterByType DEFLATE text/xml text/x-component application/xml application/xhtml+xml application/rss+xml application/atom+xml
    </IfModule>
    
    <IfModule mod_rewrite.c>
    	RewriteCond %{REQUEST_METHOD} POST
    	RewriteCond %{REQUEST_URI} (wp-comments-post|wp-login)\.php [NC]
    	RewriteCond %{HTTP_REFERER} !(.*)domainlink.com [NC,OR]
    	RewriteCond %{HTTP_USER_AGENT} ^$
    	RewriteRule .* - [L]
    </IfModule>
    
    RewriteCond %{HTTP:Accept-encoding} gzip
    RewriteCond %{REQUEST_FILENAME}\.gz -s
    RewriteRule ^(.*)\.css $1\.css\.gz [QSA]
    
    RewriteCond %{HTTP:Accept-encoding} gzip
    RewriteCond %{REQUEST_FILENAME}\.gz -s
    RewriteRule ^(.*)\.js $1\.js\.gz [QSA]
    
    RewriteRule \.css\.gz$ - [T=text/css,E=no-gzip:1,E=is_gzip:1]
    RewriteRule \.js\.gz$ - [T=text/javascript,E=no-gzip:1,E=is_gzip:1]
    Header set Content-Encoding "gzip" env=is_gzip
    
    # BEGIN WP Cloudflare Super Page Cache
    # Les directives (lignes) entre ??BEGIN WP Cloudflare Super Page Cache?? et ??END WP Cloudflare Super Page Cache?? sont générées
    # dynamiquement, et doivent être modifiées uniquement via les filtres WordPress.
    # Toute modification des directives situées entre ces marqueurs sera surchargée.
    <IfModule mod_headers.c>
    Header unset Set-Cookie "expr=resp('x-wp-cf-super-cache-active') == '1'"
    Header always unset Set-Cookie "expr=resp('x-wp-cf-super-cache-active') == '1'"
    </IfModule>
    <IfModule mod_expires.c>
    ExpiresActive on
    ExpiresByType application/xml "access plus 0 seconds"
    </IfModule>
    <FilesMatch "robots\.txt">
    <IfModule mod_headers.c>
    Header set Cache-Control "max-age=0, public"
    </IfModule>
    </FilesMatch>
    <IfModule mod_rewrite.c>
    RewriteCond %{REQUEST_URI} ^(.*)?/test/wp-content/wp-cloudflare-super-page-cache/domainlink.com/debug.log(.*)$
    RewriteRule ^(.*)$ - [F]
    </IfModule>
    # END WP Cloudflare Super Page Cache
    

    and here the link to the PageRules from Cloudflare :

    View post on imgur.com

    Thank you very much for your precious help.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter bobby

    (@mgkday)

    sorry, typo, when i click on test cache, i get : “Page caching seems not working for both dynamic and static pages.” (i can’t edit my first post)

    Plugin Contributor Salvatore Fresta

    (@salvatorefresta)

    Hi @mgkday ,

    1) The cache works for logged-out users only. Logged in user must never be cached ’cause the customer journey is personalized.

    2) You don’t need any other Cloudflare plugins installed.

    3) If the cache works in ingognito mode while logged out, it’s all ok.

    4) Sometimes the test cache action generates false negative. Check manually if the cache works as described on previous point.

    Have a nice day ??

    Thread Starter bobby

    (@mgkday)

    Hi Salvatore, thanks for your answer

    1) my website is mostly a gallery, and on the shop I sell photographies. is there a way so that i can still cache the rest of the pages with the gallery, even if the user is logged in (a user can be logged in because they made an order with woocommerce)

    2) ok, clear ??

    3) even in incognito, the images and static are showing “Cache-Control: no-cache”. The “X-WP-CF-Super-Cache: cache” headers only appears when checking for the root page (in Network). Would you know how can i fix that ?

    again thank you for your time and help

    Best,

    Plugin Contributor Salvatore Fresta

    (@salvatorefresta)

    Hi @mgkday ,

    1) No because it is not secure and can cause information leak security issues

    3) this is right because the plugin aims to perform PAGE caching. Static files such as images are already automatically cached by Cloudflare. If you want to change the cache-control value for static files you have to apply the classic browser caching rules (there is an option at the bottom of the Cache tab)

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Not certain when Page Caching is on or not’ is closed to new replies.