• Hello!

    I’m getting this message “Cache status: EXPIRED – Please try again” everytime I click on Test Cache. How can this be solved?

    Thank you very much!

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Contributor Salvatore Fresta

    (@salvatorefresta)

    Hi @davidcamba ,
    can you share your link where the plugin is active and cache enabled?

    Thread Starter davidcamba

    (@davidcamba)

    Sure Salvatore! There you go:

    https://wowinglife.com/

    Thank you very much for the plugin and the fast support, greetings from Spain:)

    Plugin Contributor Salvatore Fresta

    (@salvatorefresta)

    Hi @davidcamba ,
    there is something strange:

    $ curl -I https://wowinglife.com/
    HTTP/2 200 
    date: Wed, 03 Jun 2020 11:41:06 GMT
    content-type: text/html; charset=UTF-8
    set-cookie: __cfduid=dbdbdf3d9179a5c3410afa21282e2151f1591184462; expires=Fri, 03-Jul-20 11:41:02 GMT; path=/; domain=.wowinglife.com; HttpOnly; SameSite=Lax; Secure
    x-ua-compatible: IE=edge
    cache-control: s-max-age=604800, s-maxage=604800, max-age=60, max-age=0
    x-wp-cf-super-cache: cache
    x-wp-cf-super-cache-active: 1
    x-wp-cf-super-cache-cache-control: s-max-age=604800, s-maxage=604800, max-age=60
    set-cookie: wp_woocommerce_session_1097e5fe9fdf68822395256c7d979bba=7c415854cfc031d20baf6c6ee413f71b%7C%7C1591357264%7C%7C1591353664%7C%7C9f4b5b2df2cc43ef9dad11b69d78289a; expires=Fri, 05-Jun-2020 11:41:04 GMT; Max-Age=172800; path=/; secure; HttpOnly
    vary: Accept-Encoding
    last-modified: Wed, 03 Jun 2020 11:41:06 GMT
    expires: Wed, 03 Jun 2020 11:41:02 GMT
    x-varnish: 4676650
    x-cache: MISS
    cf-cache-status: BYPASS
    cf-request-id: 031b9529fc0000cd2e9c338200000001
    expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
    server: cloudflare
    cf-ray: 59d924899f3dcd2e-FCO

    It’s not exactly how it should be. It has a max-age = 0 added by some other service.

    The correct value should be the one present in the header x-wp-cf-super-cache-cache-control

    I see you are using Varnish. Did you configured Varnish to not cache HTML pages?

    Plugin Contributor Salvatore Fresta

    (@salvatorefresta)

    Or maybe he is adding the max_age = 0 because in the presence of the woocommerce cookie

    Thread Starter davidcamba

    (@davidcamba)

    I didn’t even know I was using Varnish…

    I’m using WP Rocket and it was caching properly until I started with Cloudflare.

    ? Regarding to WooCommerce, I chose the options not to cache Cart and Checkout. Now I’ve disabled that options and prevented /cart and /checkout URIs to be cached.

    ? I also tried to active the option “Overwrite the cache-control header for WordPress’s pages using web server rules”, but it’s not working either.

    Any ideas? Thank you very much.

    Plugin Contributor Salvatore Fresta

    (@salvatorefresta)

    Hi @davidcamba ,
    the problem is the “max-age=0” appended to cache-control. I don’t know the service in your stack which edits this HTTP header.

    I can check your htaccess if you send it to me, but I think is something at higher level such like Varnish which apparently is active (as you can see there are the x-varnish and x-cache HTTP headers into the HTTP response packet, usually set by Varnish)

    Thread Starter davidcamba

    (@davidcamba)

    Hello Salvatore!

    Here you can see my htaccess:

    # BEGIN WP Rocket v3.4.4
    # Use UTF-8 encoding for anything served text/plain or text/html
    AddDefaultCharset UTF-8
    # Force UTF-8 for a number of file formats
    <IfModule mod_mime.c>
    AddCharset UTF-8 .atom .css .js .json .rss .vtt .xml
    </IfModule>
    # FileETag None is not enough for every server.
    <IfModule mod_headers.c>
    Header unset ETag
    </IfModule>
    # Since we’re sending far-future expires, we don’t need ETags for static content.
    # developer.yahoo.com/performance/rules.html#etags
    FileETag None
    <IfModule mod_alias.c>
    <FilesMatch "\.(html|htm|rtf|rtx|txt|xsd|xsl|xml)$">
    <IfModule mod_headers.c>
    Header set X-Powered-By "WP Rocket/3.4.4"
    Header unset Pragma
    Header append Cache-Control "public"
    Header unset Last-Modified
    </IfModule>
    </FilesMatch>
    <FilesMatch "\.(css|htc|js|asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|eot|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|json|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|otf|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|png|pot|pps|ppt|pptx|ra|ram|svg|svgz|swf|tar|tif|tiff|ttf|ttc|wav|wma|wri|xla|xls|xlsx|xlt|xlw|zip)$">
    <IfModule mod_headers.c>
    Header unset Pragma
    Header append Cache-Control "public"
    </IfModule>
    </FilesMatch>
    </IfModule>
    # Expires headers (for better cache control)
    <IfModule mod_expires.c>
    	ExpiresActive on
    	# Perhaps better to whitelist expires rules? Perhaps.
    	ExpiresDefault                              "access plus 1 month"
    	# cache.appcache needs re-requests in FF 3.6 (thanks Remy ~Introducing HTML5)
    	ExpiresByType text/cache-manifest           "access plus 0 seconds"
    	# Your document html
    	ExpiresByType text/html                     "access plus 0 seconds"
    	# Data
    	ExpiresByType text/xml                      "access plus 0 seconds"
    	ExpiresByType application/xml               "access plus 0 seconds"
    	ExpiresByType application/json              "access plus 0 seconds"
    	# Feed
    	ExpiresByType application/rss+xml           "access plus 1 hour"
    	ExpiresByType application/atom+xml          "access plus 1 hour"
    	# Favicon (cannot be renamed)
    	ExpiresByType image/x-icon                  "access plus 1 week"
    	# Media: images, video, audio
    	ExpiresByType image/gif                     "access plus 4 months"
    	ExpiresByType image/png                     "access plus 4 months"
    	ExpiresByType image/jpeg                    "access plus 4 months"
    	ExpiresByType image/webp                    "access plus 4 months"
    	ExpiresByType video/ogg                     "access plus 1 month"
    	ExpiresByType audio/ogg                     "access plus 1 month"
    	ExpiresByType video/mp4                     "access plus 1 month"
    	ExpiresByType video/webm                    "access plus 1 month"
    	# HTC files  (css3pie)
    	ExpiresByType text/x-component              "access plus 1 month"
    	# Webfonts
    	ExpiresByType font/ttf                      "access plus 4 months"
    	ExpiresByType font/otf                      "access plus 4 months"
    	ExpiresByType font/woff                     "access plus 4 months"
    	ExpiresByType font/woff2                    "access plus 4 months"
    	ExpiresByType image/svg+xml                 "access plus 1 month"
    	ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
    	# CSS and JavaScript
    	ExpiresByType text/css                      "access plus 1 year"
    	ExpiresByType application/javascript        "access plus 1 year"
    </IfModule>
    # Gzip compression
    <IfModule mod_deflate.c>
    # Active compression
    SetOutputFilter DEFLATE
    # Force deflate for mangled headers
    <IfModule mod_setenvif.c>
    <IfModule mod_headers.c>
    SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
    RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
    # Don’t compress images and other uncompressible content
    SetEnvIfNoCase Request_URI \
    \.(?:gif|jpe?g|png|rar|zip|exe|flv|mov|wma|mp3|avi|swf|mp?g|mp4|webm|webp|pdf)$ no-gzip dont-vary
    </IfModule>
    </IfModule>
    # Compress all output labeled with one of the following MIME-types
    <IfModule mod_filter.c>
    AddOutputFilterByType DEFLATE application/atom+xml \
    		                          application/javascript \
    		                          application/json \
    		                          application/rss+xml \
    		                          application/vnd.ms-fontobject \
    		                          application/x-font-ttf \
    		                          application/xhtml+xml \
    		                          application/xml \
    		                          font/opentype \
    		                          image/svg+xml \
    		                          image/x-icon \
    		                          text/css \
    		                          text/html \
    		                          text/plain \
    		                          text/x-component \
    		                          text/xml
    </IfModule>
    <IfModule mod_headers.c>
    Header append Vary: Accept-Encoding
    </IfModule>
    </IfModule>
    <IfModule mod_mime.c>
    AddType text/html .html_gzip
    AddEncoding gzip .html_gzip
    </IfModule>
    <IfModule mod_setenvif.c>
    SetEnvIfNoCase Request_URI \.html_gzip$ no-gzip
    </IfModule>
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTPS} on [OR]
    RewriteCond %{SERVER_PORT} ^443$ [OR]
    RewriteCond %{HTTP:X-Forwarded-Proto} https
    RewriteRule .* - [E=WPR_SSL:-https]
    RewriteCond %{HTTP:Accept-Encoding} gzip
    RewriteRule .* - [E=WPR_ENC:_gzip]
    RewriteCond %{REQUEST_METHOD} GET
    RewriteCond %{QUERY_STRING} =""
    RewriteCond %{HTTP:Cookie} !(wordpress_logged_in_.+|wp-postpass_|wptouch_switch_toggle|comment_author_|comment_author_email_) [NC]
    RewriteCond %{REQUEST_URI} !^(/(.+/)?feed/?|/(?:.+/)?embed/|/checkout/(.*)|/cart/|/mi-cuenta/(.*)|/wc-api/v(.*)|/(index\.php/)?wp\-json(/.*|$))$ [NC]
    RewriteCond %{HTTP_USER_AGENT} !^(facebookexternalhit).* [NC]
    RewriteCond "%{DOCUMENT_ROOT}/wp-content/cache/wp-rocket/%{HTTP_HOST}%{REQUEST_URI}/index%{ENV:WPR_SSL}%{ENV:WPR_WEBP}.html%{ENV:WPR_ENC}" -f
    RewriteRule .* "/wp-content/cache/wp-rocket/%{HTTP_HOST}%{REQUEST_URI}/index%{ENV:WPR_SSL}%{ENV:WPR_WEBP}.html%{ENV:WPR_ENC}" [L]
    </IfModule>
    # END WP Rocket
    # BEGIN Imagify: webp file type
    <IfModule mod_mime.c>
    	AddType image/webp .webp
    </IfModule>
    # END Imagify: webp file type
    # BEGIN rlrssslReallySimpleSSL rsssl_version[3.3.3]
    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{HTTP:CF-Visitor} '"scheme":"http"'
    RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/
    RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
    </IfModule>
    # END rlrssslReallySimpleSSL
    # BEGIN WordPress
    # The directives (lines) between <code>BEGIN WordPress</code> and <code>END WordPress</code> are
    # dynamically generated, and should only be modified via WordPress filters.
    # Any changes to the directives between these markers will be overwritten.
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress
    # BEGIN WP Cloudflare Super Page Cache
    # The directives (lines) between <code>BEGIN WP Cloudflare Super Page Cache</code> and <code>END WP Cloudflare Super Page Cache</code> are
    # dynamically generated, and should only be modified via WordPress filters.
    # Any changes to the directives between these markers will be overwritten.
    # END WP Cloudflare Super Page Cache

    In case it’s problem of Varnish, how could I solve that?

    Thank you very much for your help!

    Plugin Contributor Salvatore Fresta

    (@salvatorefresta)

    Hi @davidcamba ,
    Please do this test. Enable the option

    Overwrite the cache-control header for WordPress’s pages using web server rules

    (which must be enabled if you are using wp-rocket otherwise this interferes with Cloudflare)

    and save. This option inserts rules into the htaccess file. Move all content between

    # BEGIN WP Cloudflare Super Page Cache

    and

    # END WP Cloudflare Super Page Cache

    at the top of the htaccess file.

    Purge the caches (wp-rocket and cloudflare) and check the response headers of the home page.

    Let me know

    Hey!
    I’m having the same problem, I thought I’d reply here instead of making a new thread.
    I, too, get the “Cache status: EXPIRED – Please try again” error. I went ahead and checked the response headers on my homepage (incognito mode) with caching enabled, and here’s what I got:

    Cache-Control: s-max-age=604800, s-maxage=604800, max-age=60
    Cache-Control: max-age=0, no-cache, s-maxage=10
    CF-Cache-Status: EXPIRED

    Setting headers for static resources through the plugin works fine.

    My server runs on Plesk, which has got a weird setup where nginx runs in front of Apache. My best guess is nginx adds it’s own cache-control headers on top of the existing ones, for whatever reason. Ideally I would just disable nginx altogether, but that’s not really possible.

    My question is: I run another custom (non-wordpress) website on the same server. Will adding those overwrite lines in nginx.conf affect it in any way? Will this solve my problem if it is infact related to nginx?

    Thanks!
    Stelios.

    Plugin Contributor Salvatore Fresta

    (@salvatorefresta)

    Hi @steliosmac ,
    sorry for the late response, I read your message only now.

    Have you enabled the option to overwrite the cache-control using web server rules?

    Usually on Apache you solve the problem. I also use Plesk with Nginx as frontend for Apache and so far I have not encountered any problems activating this option which forces the overwriting of cache-control with that of the plugin.

    Let me know

    Thread Starter davidcamba

    (@davidcamba)

    Hello! Sorry for the late answer as well.

    I used that option and nothing happened.

    What else could it be?

    Thank you very much!

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Cache status: EXPIRED – Please try again’ is closed to new replies.