• Resolved Gulshan Kumar

    (@thegulshankumar)


    Hello! Frank, hope you’re very well.

    While crawling site with ScreamingFrog I noticed 404 for the AO resources.

    Case 1. When I checked one URL manually, it returns 200 with CSS
    Can’t seems to understand why there was 404 before but now 200 for same path?

    Case 2. For another URL, it returns blog archive with latest posts.
    Ideally, it should be CSS or 404 not HTML page.

    
    Request URL: https://www.example.com/wp-content/cache/autoptimize/css/autoptimize_ab95e36a15f6054115f825914454b74f.css
    Request Method: GET
    Status Code: 404
    Remote Address: REDACTED:443
    Referrer Policy:
    strict-origin-when-cross-origin
    Cache-Control: no-cache, must-revalidate, max-age=0, no-store, private
    Content-Encoding: gzip
    Content-Type: text/html; charset=UTF-8
    Date: Mon, 14 Aug 2023 08:03:44 GMT
    Expires: Wed, 11 Jan 1984 05:00:00 GMT
    Location: /wp-content/cache/autoptimize/css/autoptimize_fallback.css
    Server: nginx
    Server-Timing: wp-load-alloptions-query;dur=2.52, wp-before-template;dur=45.93
    Strict-Transport-Security: max-age=63072000; includeSubDomains; preload
    
    Vary: Accept-Encoding
    X-Redirect-By: WordPress
    X-Ua-Compatible: IE=edge

    I am using NGINX Helper. Do I need any special config?

    Sometimes Autoptimized JS/ CSS is referenced in cached HTML but is already removed, resulting in broken sites. With this option on, Autoptimize will try to redirect those not-found files to “fallback”-versions, keeping the page/ site somewhat intact. In some cases this will require extra web-server level configuration to ensure wp-content/autoptimize_404_handler.php is set to handle 404’s in wp-content/cache/autoptimize.

    Thanks & Regards,
    Gulshan

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

    (@optimizingmatters)

    Hey Gulshan;
    re. case 1; that can happen when a page in page cache points to an autoptimized file that is not there any more at first, but when the page in cache expires it is recreated in WordPress and that will also trigger AO to recreate the optimized file if it does not exist. root cause; something caused AO file(s) to be removed without clearing (all) the page cache(s).

    re. case 2; that’s a problem with how WordPress is configured to handle “not found” resources, normally this is a search page (and AO tries to hook in to that process by redirecting to the fallback CSS/ JS for URL’s that contain cache/autoptimize) but in this case it looks like something (the theme? a plugin) is redirecting “not found” to the blog archive.

    hope this helps,
    frank

Viewing 1 replies (of 1 total)

The topic ‘Issue with fallback CSS’ is closed to new replies.