Support » Plugin: WP Super Cache » Transfer-Encoding header prevents Chrome rendering

  • Resolved jkhongusc

    (@jkhongusc)


    We run a largish WP multisite (over 400 sites). One of our sites was not able to render specific pages in Chrome and Safari; rendered fine in FF. Unfortunately it is a protected page so no-one here can view the url. This is the error message in Chrome:

    This site can’t be reached

    The webpage at https://wsguide.usc.edu/wordpress-info/wordpress-archiving/ might be temporarily down or it may have moved permanently to a new web address.
    ERR_INVALID_CHUNKED_ENCODING

    I found in the meta-wp-cache-<identifier>.php file that this header caused the problem:
    “Transfer-Encoding”:”Transfer-Encoding: chunked”

    Removing that header from the json string, made the page renderable in Chrome/Safari. I had to hack wp-cache-phase1.php::wp_cache_serve_cache_file():: line 972
    if( strpos( $header, ‘Last-Modified:’ ) === false && strpos( $header, ‘Transfer-Encoding:’ ) === false)

    to make it work in our environment.

    === WP Super Cache ===
    Contributors: donncha, automattic, kraftbj
    Tags: performance,caching,wp-cache,wp-super-cache,cache
    Tested up to: 4.8.1
    Stable tag: 1.5.5

    • This topic was modified 2 years ago by jkhongusc. Reason: added supercache version
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Donncha Ó Caoimh

    (@donncha)

    Do you have “Cache HTTP headers with page content.” enabled now? If you do, you can disable that or use the “wpsc_known_headers” to filter out “Transfer-Encoding” so that header isn’t saved when a page is cached.

    jkhongusc

    (@jkhongusc)

    Donncha –
    Thanks for the feed back.

    “Cache HTTP headers with page content.” was not enabled. To fix our problem (without modifying Supercache plugin code, I did as you suggested using the wpsc_known_headers filter. I added code to a mu-plugin and it fixes our issue.

    Thanks!

    My code snippet:

    
    add_filter('wpsc_known_headers',array($this,'uscm_wpsc_known_headers'),10,1);
    
        function uscm_wpsc_known_headers ($known_headers) {
            $return_headers = array();
            $index=0;
            foreach ($known_headers as $known_header) {
                    if (strcasecmp($known_header,'Transfer-Encoding') == 0) {
                            // Transfer-Encoding header causes rendering problems in Chrome
                    } else {
                            $return_headers[$index] = $known_header;
                            $index++;
                    }
            }
            return $return_headers;
        }
    
    jkhongusc

    (@jkhongusc)

    resolved. Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Transfer-Encoding header prevents Chrome rendering’ is closed to new replies.