• Resolved SottoVoce

    (@sottovoce)


    Hi,

    I ‘m currently using W3TC together with CloudFlare and everything works fine. The only thing that I’m not able to deal with is front page behavior when adding a new post.

    My front page is populated with latest posts in reverse chronological order, and with my current settings I’m not able to see changes when a new post is added. The only walk around is to refresh the browser (not a hard refresh), but I would like to get it working without the need of refreshing the browser.

    I know that I must have a misconfiguration, but I can’t figure it out where the problem resides.

    My current configuration is the following:

    ·Cloudflare is configured to honor headers and I’m happy about how the rules that I added to Cloudflare are working. This seems to be working ok.

    ·Cloudflare W3TC extension is configured with the “Flush CloudFlare on Post Modifications” option activated and maximum Edge Cache available by Cloudflare.

    ·Browser Cache in W3TC is configured for CSS, JS and media with a TTL of 31536000 and a control cache “public, max-age=expires-seconds”.

    ·For HTML and XML TTL is 31536000 and control cache “max-age=expires_seconds,public, must-revalidate, proxy-revalidate”.

    I understand that I should be using a lower TTL for HTML, buy this way I’m getting better caching ratio in CloudFlare. Seems to be working fine when editing a post, because W3TC is flushing CloudFlare cache correctly, but it is not working when adding a new post to front page.

    Thank you in advance.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @sottovoce

    What you are describing is normal behavior.
    If the page is cached, and the post is updated or created, the page needs to be reloaded. Browsing the website and then coming back to the home page does not reload the page but instead, you are visiting the cached page.
    If by any chance you need a hard reload that would be an issue.
    Once again, what you are describing is normal behavior and the page needs to be reloaded once updated.
    Thank you!

    Thread Starter SottoVoce

    (@sottovoce)

    Hi @vmarko thank you for your answer. By refreshing browser I mean closing browser and going to home page again = old content. Then if I click on reload, new content appears as it is supposed to happen.

    What I’m wondering is if this is a normal behavior or if something looks misconfigured. I guess that changing expires-seconds to a lower value would help.

    Thanks again.

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @sottovoce

    The default TTL is 3600s so 31536000 is a bit too much if I may say. You should also try cache-control cache with validation (“public, must-revalidate, proxy-revalidate”). But I don’t expect the behavior to change.
    The Purge Policy is set in Performance>Page Cache>Purge Policy. There you can specify the pages and feeds to purge when posts are created, edited, or comments posted.
    Thank you!

    Thread Starter SottoVoce

    (@sottovoce)

    @vmarko If I understand properly, front page cache should be cleared when adding a new post, because of Purge Policy established in Page Cache.

    In Page Cache I have Font page, post, feed, comments, author and Post terms selected. Into Cloudflare W3TC extension I also have “Flush CloudFlare on Post Modifications” option activated.

    What I assume is that if I add a new post or modify an old one, font page cache should be automatically cleared in W3TC and in CloudFlare.

    That seems to be working in an incognito window, but from a browser window that already has front page cached, no matter if I’m not logged in, changes are not showing. I tested from Safari desktop and mobile and Crome desktop and in all cases shows the same behavior.

    If I hit refresh on any browser it works (as expected)

    What I don’t completely understand is why client browser cache seems to be honoring only TTL (very long, 31536000) and not auto-refreshing because of the expired header.

    Also: this is only happening to front page. When I update any post, changes are visible almost immediately and all cache purging cycle seems to be working as expected.

    Thank you for your help Marko.
    Regards

    Thread Starter SottoVoce

    (@sottovoce)

    The solution was the following:

    Browser cache (only for for HTML and XML):

    Set expires header -> disabled
    Cache control policy -> cache with validation (“public, must-revalidate, proxy-revalidate”)

    Now when a new post is added, cache purge takes place and browser recognize changes almost immediately.

    Thank you for your help.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Browser cache and CloudFlare: Front page not updating’ is closed to new replies.