• Resolved Ritesh Saini

    (@impunk)


    Hello,

    I’m currently using BunnyCDN to serve the static assets (images, CSS, scripts, etc.) of my WordPress site using the Perfmatters plugin.

    My question is, would enabling the Browser Caching option in the Super Page Cache for the Cloudflare plugin provide any additional benefit? I want to ensure that this won’t cause any issues, particularly for users who may have outdated content cached in their browser if the static content changes.

    Also, I’ve already disabled all the other caching plugins after enabling the fallback cache in Super Page Cache.

    I appreciate any insight or advice you can provide.

    Best Regards,

    Ritesh

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Contributor iSaumya

    (@isaumya)

    Hi @impunk,

    My question is, would enabling the Browser Caching option in the Super Page Cache for the Cloudflare plugin provide any additional benefit?

    Yes, it will add the proper cache control response headers to the static files. You can check the cache-control header of your static files before and after enabling this option.

    Thread Starter Ritesh Saini

    (@impunk)

    Hi @isaumya,

    Thanks for your response. I checked the cache-control header before and after and it had the same value public, max-age=31919000

    I don’t know if it’s a good thing or bad that it didn’t change.

    Plugin Contributor iSaumya

    (@isaumya)

    Hi,
    What kind of server are you using? Are you using nginx server or apache/litespeed server with cPanel?

    Thread Starter Ritesh Saini

    (@impunk)

    Hi @isaumya,

    It’s an OpenLightSpeed server with RunCloud.

    Plugin Contributor iSaumya

    (@isaumya)

    So, does it support .htaccess file? if so, can you share your htaccess file contents?

    Thread Starter Ritesh Saini

    (@impunk)

    Yes, it supports .htaccess. I’m providing the code below:

    # BEGIN WordPress
    # The directives (lines) between "BEGIN WordPress" and "END WordPress" 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
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    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 "BEGIN WP Cloudflare Super Page Cache" and "END WP Cloudflare Super Page Cache" are
    # dynamically generated, and should only be modified via WordPress filters.
    # Any changes to the directives between these markers will be overwritten.
    <IfModule mod_headers.c>
    Header unset Pragma "expr=resp('x-wp-cf-super-cache-cache-control') != ''"
    Header always unset Pragma "expr=resp('x-wp-cf-super-cache-cache-control') != ''"
    Header unset Expires "expr=resp('x-wp-cf-super-cache-cache-control') != ''"
    Header always unset Expires "expr=resp('x-wp-cf-super-cache-cache-control') != ''"
    Header unset Cache-Control "expr=resp('x-wp-cf-super-cache-cache-control') != ''"
    Header always unset Cache-Control "expr=resp('x-wp-cf-super-cache-cache-control') != ''"
    Header always set Cache-Control "expr=%{resp:x-wp-cf-super-cache-cache-control}" "expr=resp('x-wp-cf-super-cache-cache-control') != ''"
    </IfModule>
    <IfModule mod_expires.c>
    ExpiresActive on
    ExpiresByType application/xml "access plus 0 seconds"
    ExpiresByType text/xsl "access plus 0 seconds"
    </IfModule>
    <FilesMatch "\.(xml|xsl)$">
    <IfModule mod_headers.c>
    Header set Cache-Control "no-cache, no-store, must-revalidate, max-age=0"
    </IfModule>
    </FilesMatch>
    <FilesMatch "robots\.txt">
    <IfModule mod_headers.c>
    Header set Cache-Control "no-cache, no-store, must-revalidate, max-age=0"
    </IfModule>
    </FilesMatch>
    <FilesMatch "\.(css|js|pdf)$">
    <IfModule mod_headers.c>
    Header set Cache-Control "public, must-revalidate, proxy-revalidate, immutable, max-age=2592000, stale-while-revalidate=86400, stale-if-error=604800"
    </IfModule>
    </FilesMatch>
    <FilesMatch "\.(jpg|jpeg|png|gif|ico|eot|swf|svg|webp|avif|ttf|otf|woff|woff2|ogg|mp4|mpeg|avi|mkv|webm|mp3)$">
    <IfModule mod_headers.c>
    Header set Cache-Control "public, must-revalidate, proxy-revalidate, immutable, max-age=31536000, stale-while-revalidate=86400, stale-if-error=604800"
    </IfModule>
    </FilesMatch>
    <IfModule mod_rewrite.c>
    RewriteCond %{REQUEST_URI} ^(.*)?/wp-content/wp-cloudflare-super-page-cache/edupepper.com/debug.log(.*)$
    RewriteRule ^(.*)$ - [F]
    </IfModule>
    <FilesMatch "wp-cron.php">
    <IfModule mod_headers.c>
    Header set Cache-Control "no-cache, no-store, must-revalidate, max-age=0"
    </IfModule>
    </FilesMatch>
    # END WP Cloudflare Super Page Cache
    Plugin Contributor iSaumya

    (@isaumya)

    Hi @impunk,
    As I can see the htaccess rules that this plugin is supposed to add to modify the cache control header of the static files are already there.

    You should definitely ask your host about why the following htaccess rules are not working in your website:

    <FilesMatch "\.(css|js|pdf)$">
    <IfModule mod_headers.c>
    Header set Cache-Control "public, must-revalidate, proxy-revalidate, immutable, max-age=2592000, stale-while-revalidate=86400, stale-if-error=604800"
    </IfModule>
    </FilesMatch>
    <FilesMatch "\.(jpg|jpeg|png|gif|ico|eot|swf|svg|webp|avif|ttf|otf|woff|woff2|ogg|mp4|mpeg|avi|mkv|webm|mp3)$">
    <IfModule mod_headers.c>
    Header set Cache-Control "public, must-revalidate, proxy-revalidate, immutable, max-age=31536000, stale-while-revalidate=86400, stale-if-error=604800"
    </IfModule>
    </FilesMatch>
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Should I enable browser caching when using BunnyCDN?’ is closed to new replies.