• WPR in conjunction with WPCSPC always gives Cache status: EXPIRED when hitting the “Test Cache” orange button on WPCSPC. Tried all combinations I could think of with both plugins to no avail.

    After some digging, noticed WPR writes the following in .htaccess:

    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"

    Changing those values for e.g. to: "access plus 1 hour" fixes the aforementioned issue in WPCSPC (at least for the time given in that value setting), but I’m unable to see an option to modify those settings properly in neither of the plugins nor CF. Enabling Add browser caching rules for assets in WPCSPC adds rules at the end of htaccess that do not address text/html.

    Could you please advise what’s going on and how to fix it?
    Thanks!

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

    (@alx359)

    Folowing up, commenting out this line seems to fix the “Test Cache” issue:
    #ExpiresByType text/html "access plus 0 seconds"

    However, while looking at the page headers now, I’m constantly getting CF-Cache-Status => BYPASS for all pages but the frontpage. The WPCSPC headers look fine though.

    Here’s a full sample of the response headers:

    access-control-allow-methods: GET, POST, HEAD
    alt-svc: h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400
    cache-control: s-max-age=604800, s-maxage=604800, max-age=60
    cf-cache-status: BYPASS
    cf-ray: 5ad0636a7daaf9de-PRG
    cf-request-id: 03b61c76860000f9ded52e8200000001
    content-encoding: br
    content-type: text/html; charset=UTF-8
    date: Fri, 03 Jul 2020 11:50:22 GMT
    expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
    link: <https://domain.com/?p=2384>; rel=shortlink
    server: cloudflare
    set-cookie: woocommerce_recently_viewed=2404%7C2384; path=/
    status: 200
    strict-transport-security: max-age=63072000; includeSubDomains; preload
    vary: Accept-Encoding
    x-content-type-options: nosniff
    x-download-options: noopen
    x-frame-options: SAMEORIGIN
    x-permitted-cross-domain-policies: master-only
    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
    x-xss-protection: 1; mode=block

    Kindly advise, where the issue might be?

    Thanks!

    Thread Starter alx359

    (@alx359)

    Okay, did some more reading on the bypass issue, and by enabling in WPCSPC Strip response cookies on pages that should be cached, CF-Cache-Status started hitting. Not sure yet of the side-effects of this setting though (like with the woocommerce_items_in_cart cookie).

    Anyway, have to test some more I guess. The issue still remaining for now is in the first post, or how to properly fix cache status: EXPIRED without hacking htaccess?

    Thread Starter alx359

    (@alx359)

    Unfortunately, on first tests, the WC mini-cart counter gets affected when adding stuff to the cart, and also when setting a custom cookie manages some global changes in visual presentation. Seems this approach to html caching is a no-go for me yet.

    Perhaps have to try CF Workers to see if can get around the cookie limitation of CF free. Read somewhere, Salvatore, that you’re already working in a CF Workers plugin/addon? Can’t wait! How long till that update?

    Thread Starter alx359

    (@alx359)

    Last follow-up, for future reference (might add it to the FAQ regarding WPR). Found this piece of information in WP Rocket KB:

    Cache Everything isn’t working
    The browser cache rules set by WP Rocket in the htaccess file may be preventing Cache Everything from taking effect. Use the Edge TTL setting in Cloudflare to resolve this.

    Edge Cache TTL

    Specify how long to cache a resource in the Cloudflare edge network. Edge Cache TTL only takes effect when included as a setting in a Page Rule that also sets Cache Level to Cache Everything. Edge Cache TTL isn’t visible in response headers. The minimum Edge Cache TTL depends on plan type:

    Free – 2 hours
    Pro – 1 hour
    Business – 30 minutes
    Enterprise – 1 second

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘WP Rocket tests to Cache status: EXPIRED’ is closed to new replies.