• Resolved terry777

    (@terry777)


    On one site, when I update a page/post or pdf file, the changes don’t immediately show up for users not logged in. When I check back later, logged out, they show up. Other site I have this installed on don’t do this, even one on the same host. Can you point me to possible settings that may be causing this? It wasn’t always the case, and often it doesn’t matter, but sometimes it’s important that users see the change right away. The home page is set to “your recent posts”, and if I change a post, it takes awhile to see it if not logged in. There is one pdf file that involves scheduled walks which sometimes need last-minute changes.
    At the very least, is there away to exclude the posts page and pdfs from caching?
    Thanks!

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

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

    (@vmarko)

    Hello @terry777

    Thank you for your question and I am happy to asst you with this.
    This is controlled with the Purge Policy in Performance>Page Cache. There you can manage which pages will be purged once any post is added/updated.
    So you should make sure that the following are checked:
    Front page
    Post page
    Blog feed
    Once the content is updated, the cache should be purged and the changes visible on the website. Naturally, you need to reload the page since the cache is also in the browser.
    You can also manually purge the cache in W3TC settings and check if you seeing the changes.

    I hope this helps!

    Thanks!

    Thread Starter terry777

    (@terry777)

    Thanks for getting back to me.

    I confess there is a lot about caching I don’t quite understand.

    I see the changes without a problem. It’s the users who are not logged in, but view the posts/pages/pdfs within a short time of my changes that don’t see them. They won’t know to reload the page to see the changes.

    >> I already have Front Page, Post Page and Blog Feed checked under Purge Policy.

    Under General, I had unchecked Cache Front Page in the hopes that would help – should this be checked? My thought was that if I didn’t cache it, it would show any changes ever time, am I wrong?

    I confess I don’t quite know whether to “Purge All Caches”, “Purge Modules –> Page Cache: all” I don’t even know what Opcode Cache is. On the All Posts or All Pages area, each post/page has a “Purge from Cache” option. Also, on the post/page itself, in edit mode, there is a “Purge from Cache” option.

    “Once the content is updated, the cache should be purged and the changes visible on the website. Naturally, you need to reload the page since the cache is also in the browser.”

    Does this purge the cache for ALL users, or just me? Sometimes after purging the cached I go to a different browser to see if I can see the changes there. Often I can’t. If I come back awhile later, I can. Is it the “Update Interval”? that controls this? This is set to 900 seconds, which is 15 minutes, which I think was the default. Should this be shorter?

    Users don’t normally know to reload pages, so I need it to be automatic.

    And how would a pdf get purged? There is no option on the file’s media page to specifically purge it. There’s one pdf, a list of walks, that can change frequently, so what would trigger the purge for that? It’s not the page it’s linked from, since the hyperlink hasn’t changed, just the contents of the pdf itself.

    Under “Never cache the following pages:” this is what is there, which I guess is the default setting.
    wp-.*\.php
    index\.php

    I would take that to mean they are reloaded fresh every time, but they’re not.

    Thanks!

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @terry777

    Thank you for yoru feedback.
    The PDF file is a part of the HTML. so for example on page https://yourwebsite.com/wordpress/events__trashed/backyard-feeder-census/
    <a href="https://yourwebsite.com/wordpress/wp-content/uploads/FeederCensusRemarks2007.pdf" target="_blank" rel="noopener noreferrer">Feeder Census Remarks 2006-2007</a>
    Once the Page is cached, it means that the entire HTML is cached.
    Let’s say you change the pdf file and add a new file
    <a href="https://yourwebsite.com/wordpress/wp-content/uploads/somenewpdffile.pdf" target="_blank" rel="noopener noreferrer">Feeder Census Remarks 2006-2007</a>
    If the cache is not purged, on the user end, they will still see the cached HTML file, so in order for the updated page to be served to the users, the cache needs to be purged.
    Now there is one other thing that is called Browser Cache. This means that the cache is also in the browser of the visitor. In order for the browser to fetch a new – updated page, the page needs to be reloaded. And this is how this works. So unless the page is reloaded by the user, the new and updated page will not be severe, and this is the case even when the Page is not cached at all!
    Another thing that I should mention is that the PDF can also be cached in the Browser when opened. And especially if the name of the PDF is the same and the content is the only thing that is changed. When this happens, the Browser Cache is the only problem. When Browsers checks the file, it sees the same name, and naturally, since it already has that file cached, it does not fetch the new and updated file.

    What you can do in this case is to disable Expires header and Cache-control header for Media&Other files in Performance>Browser Cache, or enable the option “Prevent caching of objects after settings change” also in Performance>Browser Cache>Media&Other files, which will add a random query string to file, for example ?xNNNNN and all you have to do in this case once the PDF is updated, make sure to click the “Update Media query string” button in the Browser Cache settings, save all settings and purge the cache. Then the browser will fetch the updated file because the query string will tell the Browser that that is a “New” file.

    I hope this helps!

    Thanks!

    • This reply was modified 2 years, 6 months ago by Marko Vasiljevic. Reason: Remove URL
    Thread Starter terry777

    (@terry777)

    Thanks, I’ll have to study this a bit to parse it out.

    Could you please edit your post to NOT show the website name? I’ve saved a screenshot so I can figure this out, and I’d rather not have the wordpress world see this. I don’t know how much of a security risk it is, but I’d feel better about it. Thanks!

    The thing is, I don’t believe I have this issue on other sites where I use your plugin, so I’ll have to study this thoroughly and compare the settings on other sites too.

    Thanks again!

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @terry777

    You are most welcome!
    I’ve removed the website name and replaced it with yourwebsite.com

    Thread Starter terry777

    (@terry777)

    Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Force no cache of pdf files’ is closed to new replies.