Support » Plugin: Autoptimize » Three caches, AO, Page, and CDN, not working well together

  • Resolved bcupham

    (@bcupham)


    Hi Frank,

    We recently moved to a new hosting service, Kinsta. They use a different CDN from our old host, Pantheon. We are noticing some problems whenever we deploy new code and clear caches. We clear the caches in this order:

    1. Autoptimize cache
    2. Page cache
    3. CDN cache.

    However, we are noticing 404 errors for the AO CSS and JS files (we use Critical CSS) on some pages. This obviously breaks the page.

    The question I have is if you know in what order we should be clearing those caches, or any other recommendations you have for dealing with this problem.

    Thank you,
    Ben

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

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Optimizing Matters

    (@optimizingmatters)

    *should* work, but maybe the safer order is

    1. CDN cache
    2. AO cache
    3. page cache

    Or you could not purge the AO cache, that way if for some reason old CSS/ JS is requested it would still be there.

    The best thing would be to get the “404 fallback” option working by activating that option and make sure nginx redirects requests for non-found AO CSS/ JS to wp-content/autoptimize_404_handler.php (there is example nginx config in the AO FAQ). That way if the normal file is not found a fallback version (which is copy of the first AO CSS/ JS created after cache clear) will be loaded, limiting the breaking somewhat/ a lot.

    Thread Starter bcupham

    (@bcupham)

    Hi Frank,

    Thank you very much. We had the 404 fallback on previously but it was causing silent DB errors because of configuration issues on Pantheon that took down the site during a traffic surge. But we might try it again.

    Thank you,
    Ben

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    care to elaborate on “the silent DB errors because of configuration issues on Pantheon that took down the site during a traffic surge”?

    Thread Starter bcupham

    (@bcupham)

    Hi Frank,

    I cannot remember the exact details, but I believe what happened was we had the 404 fallback on, but AO was unable to write the fallback files to disk. So we turned it off, and then had a traffic surge where WP was trying to find the AO JS and CSS files in the DB and getting a DB lookup error. Those errors eventually overflowed the DB error table. Something like that.

    Ben

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    well, the thing is (and that’s why I asked) that Autoptimize does not store CSS/ JS in the DB, so I’m not sure how the 404 fallback could cause db issues … yet another mystery? 😉

    Thread Starter bcupham

    (@bcupham)

    It might have been trying to reach Critical CSS. That’s in the DB, right?

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    the CCSS rules, yes, as a standard WordPress option .. still mysterious though as no link with the 404 fallback option :-/

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Three caches, AO, Page, and CDN, not working well together’ is closed to new replies.