• Resolved chrisrollins

    (@chrisrollins)


    First of all, thanks for the plugin!
    But I have an issue that’s causing my site to load pretty slowly on mobile.

    I use Divi, which has a ginormous style.css file with a query string parameter. Autoptimize optimizes it, but apparently it isn’t being gzipped.

    I’ve added add_filter('autoptimize_filter_cache_create_static_gzip','__return_true'); in a code snippet, but it only appears to work when the query string parameter is excluded.

    Using this site: https://base64.guru/tools/gzip-test, I tested if gzip was enabled for the autoptimized divi css without the query string and it says it is.
    Then I tested with the query string and it says it isn’t.

    Google Pagespeed Insights confirms this, reporting that it takes a whopping 9 seconds to display the first text on my site.

    I’m on an nginx server, which, from what I’ve read, doesn’t discriminate by query strings when gzipping, so I can only assume the problem is on WordPress’s end.

    I’m using Autoptimize in conjunction with WP Fastest Cache. Any idea if there’s something I’m doing wrong with Autoptimize? Or might this be a problem with the gzipping feature of WP Fastest Cache?

    I’m new to all this so thank you ahead of time for any help you can provide!

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

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter chrisrollins

    (@chrisrollins)

    I wrote too soon… Apparently it has to do with more than just query strings…

    For example on this page: https://myenglishgoals.com/aprende-ingles-con-canciones-have-yourself-a-merry-little-christmas/

    This resource is served gzipped even though it has a query string: https://myenglishgoals.com/wp-includes/css/dashicons.min.css?ver=5.3.2

    But the autoptimized scripts are not, for example: https://myenglishgoals.com/wp-content/cache/autoptimize/css/autoptimize_25b2a7b61005a5795e263955be674dc6.css

    I’m so lost ??

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    Some pointers:
    * the code snippet you use tells AO to create gzipped files, do you see those on the filesystem of your server?
    * but even with the filter, this only works if nginx is configured to use those gzipped files, is that the case?
    * if not using gzipped files, nginx should gzip “on the fly”
    * as you’re using cloudflare, gzipping (or better, brotli) should -also- happen there
    * if all else fails you could try untickin the “serve as static files” option, in which case the autoptimized CSS/ JS is compressed using PHP

    hope this helps,
    frank

    Thread Starter chrisrollins

    (@chrisrollins)

    Thanks, Frank! It did help. After reading your tips I confirmed that the gzipped files are on the server. I learned I needed to add gzip_static on; to my nginx settings in order to use them.

    Once I enabled that, the site started loading much faster.

    But I’m still confused because, like you said, Cloudflare should be automatically Brotlifying them. I checked that Brotli compression is enabled in Cloudflare, yet when investigating with Chrome Developer Tools, all resources respond with content-encoding: gzip.

    Also, since adjusting my nginx settings, even though my site loads faster, I now get an “F” rating on gtmetrix, complaining that compression is not enabled.

    I wish I knew what was going on, but I’m happy the site is loading faster. Thank you for your help!

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    I guess that for the non-autoptimized files there no is no compression any more, as there’s no statically gzipped file any more?

    But what concerns Cloudflare; no idea I’m afraid. Maybe ask them? ??

    And lastly; feel free to rate the plugin & support here ??

    Thread Starter chrisrollins

    (@chrisrollins)

    All files are gzipped now from what I can tell. My nginx was already configured to gzip them. Not sure why I was only seeing some files gzipped and others not though.

    The only difference now is that it serves up the static gzipped file if it exists before trying to gzip the file itself.

    Definitely gonna contact Cloudflare to ask about the Brotli issue. Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Gzip not working with autoptimize css with query strings’ is closed to new replies.