Title: Nginx and Cache Enabler&#039;s Pre-compression causing content decoding errors
Last modified: August 31, 2016

---

# Nginx and Cache Enabler's Pre-compression causing content decoding errors

 *  Resolved [Draikin](https://wordpress.org/support/users/draikin/)
 * (@draikin)
 * [10 years ago](https://wordpress.org/support/topic/nginx-and-cache-enablers-pre-compression-causing-content-decoding-errors/)
 * 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://wordpress.org/support/topic/difficult-problem-with-double-content-encoding-gzip-content-encoding-gzip?replies=2](https://wordpress.org/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://wordpress.org/plugins/cache-enabler/](https://wordpress.org/plugins/cache-enabler/)

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [KeyCDN](https://wordpress.org/support/users/keycdn/)
 * (@keycdn)
 * [10 years ago](https://wordpress.org/support/topic/nginx-and-cache-enablers-pre-compression-causing-content-decoding-errors/#post-7397563)
 * 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/](https://www.keycdn.com/support/wordpress-cache-enabler-plugin/)
 * Have you tried this already?
 *  Plugin Author [KeyCDN](https://wordpress.org/support/users/keycdn/)
 * (@keycdn)
 * [10 years ago](https://wordpress.org/support/topic/nginx-and-cache-enablers-pre-compression-causing-content-decoding-errors/#post-7397643)
 * 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/](https://www.keycdn.com/support/wordpress-cache-enabler-plugin/)
 *  Thread Starter [Draikin](https://wordpress.org/support/users/draikin/)
 * (@draikin)
 * [10 years ago](https://wordpress.org/support/topic/nginx-and-cache-enablers-pre-compression-causing-content-decoding-errors/#post-7397644)
 * 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.

 * ![](https://ps.w.org/cache-enabler/assets/icon.svg?rev=2442383)
 * [Cache Enabler](https://wordpress.org/plugins/cache-enabler/)
 * [Support Threads](https://wordpress.org/support/plugin/cache-enabler/)
 * [Active Topics](https://wordpress.org/support/plugin/cache-enabler/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/cache-enabler/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/cache-enabler/reviews/)

## Tags

 * [compression](https://wordpress.org/support/topic-tag/compression/)
 * [gzip](https://wordpress.org/support/topic-tag/gzip/)
 * [nginx](https://wordpress.org/support/topic-tag/nginx/)

 * 3 replies
 * 2 participants
 * Last reply from: [Draikin](https://wordpress.org/support/users/draikin/)
 * Last activity: [10 years ago](https://wordpress.org/support/topic/nginx-and-cache-enablers-pre-compression-causing-content-decoding-errors/#post-7397644)
 * Status: resolved