• Resolved denise8a

    (@denise8a)


    Hi!

    I’ve tried to read similar posts but still can’t find the issue with my site.
    Error on dynamic page (https://refaccionesgraficasdelnorte.com): Invalid Cache-Control response header. If you are using Litespeed Server, please disable the option Overwrite the cache-control header for WordPress’s pages using web server rules, purge the cache and retry.

    Error on static resource (https://refaccionesgraficasdelnorte.com/rgn/wp-content/plugins/wp-cloudflare-page-cache/assets/testcache.html): Cache status: BYPASS – Cloudflare has been instructed to not cache this asset. It has been served directly from the origin.

    Please check if the page caching is working by yourself by surfing the website in incognito mode ’cause sometimes Cloudflare bypass the cache for cURL requests. Reload a page two or three times. If you see the response header cf-cache-status: HIT, the page caching is working well.

    I looked into the cloudflare configuration:
    – page rule was properly created
    – Browser Cache TTL is set to respect existing headers.
    I don’t have any other cache plugins.

    Thanks for your kind support!
    Denise

    The page I need help with: [log in to see the link]

Viewing 9 replies - 1 through 9 (of 9 total)
  • Mat

    (@mateithemeisle)

    Hello @denise8a,

    Thank you for using WP Cloudflare Super Page Cache and for reaching out!

    I checked the control header on your website and it seems t be looking like this
    cache-control: no-store, no-cache, must-revalidate, max-age=0 which shouldn’t be happening if the caching is working properly.

    Can you please make sure to:
    1) Overwrite the cache-control header for WordPress’s pages using web server rules is disabled under the Cache tab of the plugin?
    2) Strip response cookies on pages that should be cached under the Cache is also disabled?

    If this didn’t work, can you please share a screenshot of your CF rules, the plugins cache tab settings, and of the rules written in the htaccess file?

    Thank you and we’ll wait for your answer!

    Plugin Contributor iSaumya

    (@isaumya)

    Hi,
    the reason you are having this problem is because in your site currently there are 2 cache-control header is being added. One by this plugin and the other either by some other plugin or via your server hosting rule. Screenshot: https://i.imgur.com/A8qtPlL.jpeg

    In order for everything to work smoothly, you need to make sure that the second cache-control rule i.e. cache-control: no-store, no-cache, must-revalidate, max-age=0 is no longer present.

    Here is what I want you to do:
    1. Inside the plugin settings, under Cache tab, make sure that the “Overwrite the cache-control header” option is DISABLED.
    2. If it is already disabled, then check if you have any other caching plugin installed in your website or not. If there is any other cache plugin installed, diable that.
    3. Finally if the issue is still present, then please contact your host and ask them if they are adding the cache-control: no-store, no-cache, must-revalidate, max-age=0 rule vis some server rule or not, if so, please ask them to remove that.

    Thread Starter denise8a

    (@denise8a)

    Thanks both @mateithemeisle and @isaumya!
    I checked with my host provider and they confirmed not adding any server rule from their side.
    I’m not using any other plugin with cache features on the site.
    Looking in to my htaccess I think cache control is being applied by the WP Cloudflare itself.

    # BEGIN WordPress
    # Las directivas (líneas) entre "BEGIN WordPress" y "END WordPress" son
    # generadas dinámicamente y solo deberían ser modificadas mediante filtros de WordPress.
    # Cualquier cambio en las directivas que hay entre esos marcadores serán sobrescritas.
    <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
    
    # Wordfence WAF
    <IfModule LiteSpeed>
    	php_value auto_prepend_file '/home/refacci5/public_html/rgn/wordfence-waf.php'
    </IfModule>
    <IfModule lsapi_module>
    	php_value auto_prepend_file '/home/refacci5/public_html/rgn/wordfence-waf.php'
    </IfModule>
    <Files ".user.ini">
    	<IfModule mod_authz_core.c>
    		Require all denied
    	</IfModule>
    	<IfModule !mod_authz_core.c>
    		Order deny,allow
    		Deny from all
    	</IfModule>
    </Files>
    
    # END Wordfence WAF
    
    # php -- BEGIN cPanel-generated handler, do not edit
    # This domain inherits the “PHP” package.
    # php -- END cPanel-generated handler, do not edit
    
    # BEGIN WP Cloudflare Super Page Cache
    # Las directivas (líneas) entre "BEGIN WP Cloudflare Super Page Cache" y "END WP Cloudflare Super Page Cache" son
    # generadas dinámicamente y solo deberían ser modificadas mediante filtros de WordPress.
    # Cualquier cambio en las directivas que hay entre esos marcadores serán sobrescritas.
    <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>
    <IfModule mod_rewrite.c>
    RewriteCond %{REQUEST_URI} ^(.*)?/rgn/wp-content/wp-cloudflare-super-page-cache/refaccionesgraficasdelnorte.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

    Here my plugin cache settings:
    settings
    settings 2
    settings 3

    CF page rule:
    CF Page rule

    Thanks a lot for your help!
    Denise

    Plugin Contributor iSaumya

    (@isaumya)

    Hi,
    OK. Go to the plugin settings > disable page cache.
    Then go inside the wp admin and deactivate the plugin. After this also double check that the htaccess code added by the plugin has ben automatically removed by the plugin after being deactivated.
    After that let us know so that I can check if those headers are still being added to your page or not.

    Thread Starter denise8a

    (@denise8a)

    Thanks @isaumya!
    Done.
    Follow the suggested steps and I could verified that the htaccess plugin code was successfully removed.
    However I still see the cache-control: no-store, no-cache, must-revalidate, max-age=0
    ??
    Let me know!
    Thanks!

    Plugin Contributor iSaumya

    (@isaumya)

    Hi @denise8a,
    Thanks for letting me know. So, now as those htaccess codes had been removed and the plugin has been deactivated, which means that the cache-control: no-store, no-cache, must-revalidate, max-age=0 header is not being added by the plugin but rather is being added either by some other plugin or server level rule.

    If you want you can completely delete this plugin (from WP Admin) from your site and you will see that the same cache control header is still present.

    Now. I know it is very hard to find what is adding this header.
    But there must be some other plugin that is adding this header. You should try disabling unimportant plugins from your site and check if the header is still there.

    You should also check if there is any must use plugins in your site as that might be adding that.

    If no plugin is adding the header, then definitely it is being added by server rule.

    Thread Starter denise8a

    (@denise8a)

    Thanks @isaumya!
    I did a staging site and deactivated every single plugin and the header is still there.
    I will come back with the hosting provider and request again to review the possible server rule.

    Just by curiosity. I used to have cloudflare activated by the cpanel application, and recently I asked the hosting provider to make the necessary adjustments to use the cloudflare account directly. Somehow they remove it from the cpanel app, did DNS changes and my site is now directly connected at the cloudflare website.
    I experience several speed issues and server errors during the transition and they did something and was finally fixed.
    Could this be related to this type of cache control?

    Thank you for your help!
    Denise

    Plugin Contributor iSaumya

    (@isaumya)

    This could be. As you have said that you have deactivated all the plugins and it was still there which means that the cache-control header is being added by your server level configuration.

    The best solution to this would be to contact your hosting provider and ask them to remove that cache control rule that they are adding onto your site.

    An alternative approach to this would be to try the option inside this plugin settings (under cache tab) called “Overwrite cache-control header”.

    That might solve the issue for you, you can try. But then again the best approach would be to remove the cache control header added by the hosting company. But if your hosting company doesn’t have a brilliant technical support, then you can try the overwrite cache control header and check what happens.

    Let me know.

    Thread Starter denise8a

    (@denise8a)

    Thank you for your great and prompt support @isaumya and @mateithemeisle!

    I’ll close this ticket since it looks like I do have an issue with my host.
    Thanks again!
    Denise

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Page Caching not working for both dynamic and static pages’ is closed to new replies.