Support » Plugin: Cache Enabler - WordPress Cache » (html gzip) files seem to not be served

  • Hello,

    After checking your documentation, I was alerted by this chapter :
    https://www.keycdn.com/support/wordpress-cache-enabler-plugin#how-can-i-check-if-the-cache-enabler-is-working-on-my-site

    So I went in privacy mode, checked for the source and I realized that the served cached files were (html) :
    Cache Enabler by KeyCDN @ 27.11.2019 15:23:21 (html)

    Then I went in the cache-enabler folder on the FTP and verified if a .html.gz exists. It DOES exist, and I know my browser is accepting gzip files.

    My questions are :

    In the Network tab, I can see that the sent files might be served compressed because the transfered datas overnetwork are around 15% of the ressource size. So I guess that the server is compressing on the fly each time it is requested. Is this statement true ?

    If the .html.gz files were served, will I see (html) anyway in the comment at the end of the source OR will I see (html gzip) at end ? (I guess the second, (html gzip), isn’t it ?)

    In order not to compress files on the fly at every request, and, if (html gzip) should be outputed in this comment line, how can I enable the server to send the .html.gz version of the files ?

    Thank you very much for your advices.

Viewing 15 replies - 1 through 15 (of 18 total)
  • Can you please provide a direct URL to where this is occurring so I can troubleshoot this further?

    Hello,
    Thank you for your reply !
    Where can I send you a private message ?

    Hello,

    In fact what I see at bottom of the page is :

    <!-- Cache Enabler by KeyCDN @ 09.12.2019 15:40:45 (html) -->

    If everything was setup correctly, I guess I should see :

    <!-- Cache Enabler by KeyCDN @ 09.12.2019 15:40:45 (html gzip) -->

    Could you explain me in which cases (html)/(html gzip) pages should be served ? And how to enable it ?

    Thank you very much

    Hello,

    What should I do in order to serve already gzipped html ?
    For now I can only get html files that are gzipped each time it is requested.

    Thank you

    Do you have any other layer(s) of caching configured, such as another caching plugin or a caching solution provided by your hosting provider? If yes, please disable it to ensure the Cache Enabler plugin is able to deliver the cached pages.

    @coreyk

    Yes I also have Autoptimize but except this pre-compression issue it works and I have read that AO and CE have been updated to co-exist better.

    I have disabled AO for the test and it is still retrieving html not compressed.

    Could you provide me with the correct .htaccess rules or if you have a link to advise it would be nice ?

    Thank you

    AO (I’m the developer) is not a (page) caching plugin, that’s why it’s great in combination with CE 🙂

    re. HTML vs HTML/GZIP; try the “Pre-compression of cached pages. Needs to be disabled if the decoding fails in the web browser.” option maybe?

    @optimizingmatters thank you for helping

    Just before I see your answer I tried to disabled (was enabled) it with no success so I re-enabled this option because I am not sure the decoding fails as it well serves compressed files on the fly.

    What are the ‘signs’ of a failed decoding ? Everything is broken ?

    @coreyk

    Can it be linked to the CDN solution included with by my hosting providers ?

    When the “Pre-compression of cached pages. Needs to be disabled if the decoding fails in the web browser” option is active, you *normally* should see html gzip. If not then you indeed you might have a caching layer in front of CE (e.g. at your hoster or cloudflare with page rules or sucuri or …) which prevents CE from serving gzipped HTML.

    If “the decoding fails in the web browser” you’ll see (seemingly) garbled/ random text, it will be _very_ obvious 🙂

    If “the decoding fails in the web browser” you’ll see (seemingly) garbled/ random text, it will be _very_ obvious

    Haha thanks this is what I imagined ! So nothing about it I could have missed until here.

    In order to maybe/possibly override hoster rules, I have added this to the .htaccess file (found here)

    AddEncoding gzip .gz
    
    # HTML
    RewriteCond %{HTTP:Accept-encoding} gzip
    RewriteCond %{REQUEST_FILENAME}\.gz -s
    RewriteRule ^(.*)\.html $1\.html\.gz [QSA]
    
    # CSS
    RewriteCond %{HTTP:Accept-encoding} gzip
    RewriteCond %{REQUEST_FILENAME}\.gz -s
    RewriteRule ^(.*)\.css $1\.css\.gz [QSA]
    
    # JS
    RewriteCond %{HTTP:Accept-encoding} gzip
    RewriteCond %{REQUEST_FILENAME}\.gz -s
    RewriteRule ^(.*)\.js $1\.js\.gz [QSA]
    
    # Serve correct content types, and prevent mod_deflate double gzip.
    RewriteRule \.html\.gz$ - [T=text/html,E=no-gzip:1]
    RewriteRule \.css\.gz$ - [T=text/css,E=no-gzip:1]
    RewriteRule \.js\.gz$ - [T=text/javascript,E=no-gzip:1]
    
      RewriteCond %{REQUEST_FILENAME} -f
      RewriteCond %{THE_REQUEST} (.*)\.html\.gz$
      RewriteRule ^.*$ - [NC,L]
    
    Header set Content-Encoding "gzip" env=is_gzip

    With no more success, as the served HTML, JS and CSS files are still served as non pre-compressed files.

    I just performed a CURL command and I can see the (html gzip) in the cache enabler bottom comment.
    If I check this comment in dev tool, I only have (html), the time is the same.

    Would you have an idea of what does it mean ?

    It’s difficult to have a concrete answer as you haven’t provided a direct URL to be able to check the page, however, from what you’ve provided you may just need to completely clear your browser cache.

    If this still doesn’t resolve the issue that you’re experiencing please temporarily disable any page caching layer(s) in front of the Cache Enabler plugin.

    Hello @coreyk

    Let me know where I can send you the link ?

    from what you’ve provided you may just need to completely clear your browser cache

    Private nav + cache disabled isn’t enough ?
    I did it anyway but still have (html) version served.

    If this still doesn’t resolve the issue that you’re experiencing please temporarily disable any page caching layer(s) in front of the Cache Enabler plugin.

    The only other caching plugin installed is autoptimize and as the plugin author said it only manages css and js. I did it anyway and the result is still the same : (html) version served.
    Linked question : is there a way to verify if the served assets are the ones pre-compressed or compressed on the fly ?

    If I can be served with precompressed ressources (cURL command), can I exclude a server-side issue ?

    To troubleshoot this further, does this issue still occur after temporarily restoring your .htaccess file to the default?

    If yes, you can provide a direct URL to a page experiencing this issue in this support thread. If you’re unable to provide this please provide the response headers to the page instead. In case you don’t know, you can access the response headers in the Network panel of your browser’s developer tools.

Viewing 15 replies - 1 through 15 (of 18 total)
  • You must be logged in to reply to this topic.