• Resolved allnamestaken

    (@allnamestaken)


    Does browser cache gets disable in cloudflare when plugin is enabled? It seems that setting got changed to respect existing headers. Should I re enable it?

    Do I need to edit nginx.conf file for the plugin?

    Im trying to figure out how to enable browser cache via plugin+nginx settings or directly from cloudflare through Browser Cache TTL?

    Also I noticed that blocking time gets high when I enable bot fighting mode. I know its not related to the plugin but if you have any ideas I would appreciate it.

    Thank you in advance.

    • This topic was modified 2 years, 6 months ago by allnamestaken.
Viewing 7 replies - 16 through 22 (of 22 total)
  • Thread Starter allnamestaken

    (@allnamestaken)

    also would have any thoughts on use of Google PageSpeed module, also known as mod_PageSpeed? Thanks in advance.

    Plugin Contributor iSaumya

    (@isaumya)

    Saumya so this rule does not work “location ~* \.(xml|xsl)$ { add_header Cache-Control “no-cache, no-store, must-revalidate, max-age=0”; expires -1; }” because its meant for static files and sitemap.xml does not exist as its being dynamically generated by the seo framework and I assume other plugins as well.

    – Yes this rule is for the static XML and xsl files. But what I don’t understand is how it can cause issue for dynamically generated XML files. I have this rule on every server where the sitemap XML file is dynamically generated and have zero issues.

    would have any thoughts on use of Google PageSpeed module, also known as mod_PageSpeed?

    – It’s a super old module when optimization and caching system were not this advanced.
    But when using this plugin don’t use mod pagespeed. As Cloudflare is handling the things.

    Hello! Author of The SEO Framework here.

    That rule causes NGINX to expect a valid static XML file to be located on the server, which isn’t the case with PHP-generated XML output.

    If it still works on your site, even with that rule in place, you’re probably using a specific override of the rule that redirects the sitemap endpoint back to the PHP engine.

    Still, this recipe should be strictly followed when using WordPress websites; notice the lack of specifics, for WordPress is dynamic (something NGINX is actually bad at): https://www.nginx.com/resources/wiki/start/topics/recipes/wordpress/. With this, any WordPress installation will work out of the box.

    Thread Starter allnamestaken

    (@allnamestaken)

    @isaumya Sitemap is being cashed without that rule, any advice how could we stop caching of the dynamically generated sitemap?

    • This reply was modified 2 years, 5 months ago by allnamestaken.
    Plugin Contributor iSaumya

    (@isaumya)

    Hi @cybr,
    Sorry for the delayed reply due to the festive season here.

    That rule causes NGINX to expect a valid static XML file to be located on the server, which isn’t the case with PHP-generated XML output.

    – Thanks for joining this conversation. That rule tells NGINX that IF there is a static XML or XSL file then to use that cache-control header – that’s it. But if there is no static file then that won’t get invoked.

    Moreover, both Yoast SEO and Rankmath uses the dynamic PHP based sitemap generation approach and this issue is not present despite having that rule in the NGINX.

    If it still works on your site, even with that rule in place, you’re probably using a specific override of the rule that redirects the sitemap endpoint back to the PHP engine.

    – Maybe, but not sure of that as I’m not personally aware of any such overwrite rules.
    Cause Rankmath ask users to add a specific NGINX rule for their system to work. Example:

    
     # START Nginx Rewrites for Rank Math Sitemaps
     rewrite ^/sitemap_index.xml$ /index.php?sitemap=1 last;
     rewrite ^/([^/]+?)-sitemap([0-9]+)?.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;
     # END Nginx Rewrites for Rank Math Sitemaps
    

    So, maybe that’s overwriting as you stated above.

    Anyways, if that rule is causing any problem, you can definitely comment it if you feel so.

    —————–

    Now coming to your question @allnamestaken,
    you should ask your sitemap generator plugin developer if there is any filter or way to set the cache-control header value of the sitemap files to no-cache, no-store, must-revalidate, max-age=0. That will tell Cloudflare not to cache the sitemap pages.

    Thread Starter allnamestaken

    (@allnamestaken)

    Ive tried adding rankmath rewrite rule, it did not work I was still getting 404.

    So what I did was add *mydomain.com/*.xml Cache Level: Bypass to page rules in cloudflare dashboard and now it works. Sitemap is not being cached. Thank you for your help.

    Plugin Contributor iSaumya

    (@isaumya)

    Good to know that your issue has been resolved.

Viewing 7 replies - 16 through 22 (of 22 total)
  • The topic ‘Browser Cache & nginx setting confusion’ is closed to new replies.