Title: difficult problem with double &quot;Content-Encoding: gzip&quot; &quot;Content-Encoding: gzip&quot;
Last modified: August 22, 2016

---

# difficult problem with double "Content-Encoding: gzip" "Content-Encoding: gzip"

 *  [_ck_](https://wordpress.org/support/users/_ck_/)
 * (@_ck_)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/difficult-problem-with-double-content-encoding-gzip-content-encoding-gzip/)
 * Using WP 4.1 and wp-super-cache 1.4.2
 * I am having a difficult problem eliminating a special case of double encoding
   by nginx of supercache’s already gzipped output when legacy cache files are served.
 * Most modern browsers figure out this problem and properly double decode the situation
   but Safari does not.
 * I am able to reproduce this problem consistently on mobile safari and the last
   Windows desktop Safari 5
 * Basically take any logged out user and they will see regular wordpress posts 
   fine.
 * Then add a query string to any post url the the problem will happen.
 * example.com/blah-blah?abc=123
 *     ```
       Content-Type	 text/html; charset=UTF-8
        Transfer-Encoding	 chunked
        Connection	 keep-alive
        Content-Encoding	 gzip
        Content-Encoding	 gzip
        Vary	 Accept-Encoding, Cookie
        WP-Super-Cache	 Served legacy cache file
       ```
   
 * Note you need a special header viewer to see the double gzip header because some
   browsers will merge them entirely or show `gzip, gzip` instead.
 * What is happening is wp-super-cache is dumping the raw gzipped cache file though
   PHP and adding a content-encoding header but then NGINX is also configured to
   GZIP all output from PHP backend.
 * So it gets double gzipped.
 * One harsh way to fix this would be to disable all gzip in wp-super-cache which
   I do not want to do, since nginx can easily serve the already gzipped files.
 * I’ve researched nginx and there does not appear to be any way to disable the 
   gzip if the backend already has a header set.
 * Which means the problem has to be fixed inside the plugin, somewhere in phase1
   or phase2
 * Thanks for any help
 * [https://wordpress.org/plugins/wp-super-cache/](https://wordpress.org/plugins/wp-super-cache/)

Viewing 1 replies (of 1 total)

 *  Thread Starter [_ck_](https://wordpress.org/support/users/_ck_/)
 * (@_ck_)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/difficult-problem-with-double-content-encoding-gzip-content-encoding-gzip/#post-5665844)
 * Okay figured out a simple workaround if anyone runs into this in the future
 * in phase1 just `return false` when testing gzip_accepted
 * `function gzip_accepted(){ return false;`
 * This way supercache still makes the `.gz` files for direct serving via nginx 
   but will use the non-gzip version of the file when it falls through to legacy
   mode when a url query is present. Then nginx will still gzip the output properly.

Viewing 1 replies (of 1 total)

The topic ‘difficult problem with double "Content-Encoding: gzip" "Content-Encoding:
gzip"’ is closed to new replies.

 * ![](https://ps.w.org/wp-super-cache/assets/icon-256x256.png?rev=3506220)
 * [WP Super Cache](https://wordpress.org/plugins/wp-super-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-super-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-super-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-super-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-super-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-super-cache/reviews/)

## Tags

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

 * 1 reply
 * 1 participant
 * Last reply from: [_ck_](https://wordpress.org/support/users/_ck_/)
 * Last activity: [11 years, 5 months ago](https://wordpress.org/support/topic/difficult-problem-with-double-content-encoding-gzip-content-encoding-gzip/#post-5665844)
 * Status: not resolved