• Resolved Draikin

    (@draikin)


    Given a fairly standard Nginx configuration for WordPress, I’m encountering problems when enabling the “Pre-compression of cached pages.” option in Cache Enabler. Here’s a part of the Nginx config:

    location / {
    try_files $uri $uri/ /index.php$is_args$args;
    }

    This, combined with “Pre-compression of cached pages.” in Cache Enabler will give a content decoding error (but only from the second time the page is loaded, the first time the page still displays correctly). Surprisingly, this happens even when I disable gzip in Nginx altogether. For example, Here are the headers for the first two requests on the same page in WordPress:

    1st Page Load (this one displays correctly)

    HTTP/1.1 200 OK
    Server: nginx/1.10.0 (Ubuntu)
    Date: Wed, 18 May 2016 19:35:57 GMT
    Content-Type: text/html; charset=UTF-8
    Transfer-Encoding: chunked
    Connection: keep-alive

    2nd Page Load (ERR_CONTENT_DECODING_FAILED in Chrome)

    HTTP/1.1 200 OK
    Server: nginx/1.10.0 (Ubuntu)
    Date: Wed, 18 May 2016 19:35:59 GMT
    Content-Type: text/html; charset=UTF-8
    Transfer-Encoding: chunked
    Connection: keep-alive
    X-Cache-Handler: php
    Content-Encoding: gzip

    Perhaps I’m seeing the same thing described here: https://www.ads-software.com/support/topic/difficult-problem-with-double-content-encoding-gzip-content-encoding-gzip?replies=2

    I’m guessing the issue here is indeed that the content is gzip encoded twice, and even when gzip is disabled in the Nginx config file. I can confirm that the fix mentioned in that thread for WP Super Cache works. So I imagine that, if the same could be done for Cache Enabler, it would probably also resolve the problem. In other words, I’d need to be able to tell Cache Enabler to only create the .gz file, but not actually send gzipped content to Nginx.

    I’m interested in hearing if this problem can be reproduced, because I encountered this on two different configurations and with both WP Super Cache and Cache Enabler. If you’re wondering why I’m even bothering with the pre-compression from Cache Enabler and don’t just let Nginx handle gzipping everything: I’d like to make use of the gzip_static option in Nginx, so that it doesn’t need to compress the files on each and every request.

    https://www.ads-software.com/plugins/cache-enabler/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author KeyCDN

    (@keycdn)

    We have created an nginx configuration snippet, which we are using ourself.

    You can find it here:
    https://www.keycdn.com/support/wordpress-cache-enabler-plugin/

    Have you tried this already?

    Plugin Author KeyCDN

    (@keycdn)

    Most likely this is due to the content get compressed twice. Just check the nginx config here: https://www.keycdn.com/support/wordpress-cache-enabler-plugin/

    Thread Starter Draikin

    (@draikin)

    The Nginx config you’re using does indeed work, as it doesn’t get into the situation where PHP processing takes place with the gzip file already cached on the disk. I understand that it’s being compressed twice, but I’m just curious about what’s causing this, since it happens even with gzip being disabled entirely in Nginx. So in that regard, it would be nice to have the option to prevent Cache Enabler from sending gzip content to Nginx, without disabling the creation of .gzip files. But admittedly, this only happens in the configuration I posted above.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Nginx and Cache Enabler's Pre-compression causing content decoding errors’ is closed to new replies.