• Resolved Viktor

    (@grnetfreak)


    Hello Frank,

    We’ve been seeing some random 404 errors on multiple static files on a site hosted @ WPEngine. From their end, they said they aren’t seeing anything “off”. Purging the cache makes it work, checking the logs, nothing specific seems to be triggering this. ( e.g. a new post published )

    Running WP 5.6.2 + Autoptimize 2.8.1 and with 404 fallbacks enabled of course.

    Any ideas?

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

    (@optimizingmatters)

    I’m assuming the static files you mention are Autoptimized CSS/ JS files? Can you test if the fallbacks work by taking the URL of an Autoptimized JS-file and changing one number/ letter in the hash (the random part of the filename), it should redirect to autoptimize_fallback.js?

    frank

    Thread Starter Viktor

    (@grnetfreak)

    Static files I meant are indeed the Autoptimize generated files! The fallbacks aren’t working:

    I tried checking a CSS file autoptimize_164ccbfc71db096c97870abc99e0edd8.css – tried changing a letter or number near the end of the string, returns 404.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    You’ll need to ask WPEngine to either:
    * have 404’s handled by WordPress
    * OR ensure 404’s for wp-content/cache/autoptimize/ get redirected to /wp-content/autoptimize_404_handler.php, see example nginx configuration below

    location ~* /wp-content/cache/autoptimize/.*\.(js|css)$ {
        try_files $uri $uri/ /wp-content/autoptimize_404_handler.php;
    }
    Thread Starter Viktor

    (@grnetfreak)

    Thank you for the tip! WPEngine has added the code but now testing to see the filename change – I get a 410 error – I’ve enabled the error logging with the filter you have to monitor this!

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    410 is when the fallback-handler does not find the fallback-file (wp-content/cache/autoptimize/js/autoptimize_fallback.js), can you check if that exists?

    additionally; 404 fallback only works when you’re serving the AO files as static files, this option is on by default but maybe you changed it?

    Thread Starter Viktor

    (@grnetfreak)

    The autoptimize_fallback.js does exist and it’s accessible directly, but the 410 still exists.

    And yeah, I have all but the last one ( shop cart/checkout ) options enabled at the Misc Options. ( I think that’s the default setup? )

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    no idea I’m afraid .. can you share your site’s URL?

    Thread Starter Viktor

    (@grnetfreak)

    Could I share it privately? I replicated the issue in another environment with same Autoptimize settings but without random 404 errors at the moment ( it was the same nginx rules you suggested ) – So it could be a WPEngine wide issue for the 404 fallback?

    PS: I have Frank’s email from an old conversation

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    yes, it could be WP Engine wide; the basic issue is that normally WordPress handles 404’s, which AO hooks into. feel free to mail me ??

    frank

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    hey grnetfreak ; I’m not sure if I ever received your mail (maybe I did and I forgot)? ??

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    No feedback so I assume this got resolved? Feel free to follow up if you still encounter issues!

    have a nice day!
    frank

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘404 errors on static files ( WPEngine )’ is closed to new replies.