• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Question Pagespeed (ngx_pagespeed) content encoding error

Dukemaster

Regular Pleskian
Hi at all,
for people how are interested in discussions about pagespeed configuration in different scenarios I wanted to start one thread which refers to the usage of Woltlab CMS, more precisely "Woltlab Suite 3".
Background: I installed ngx_pagespeed by the great tutorial of @UFHH01 in a simple configuration, let's say origin config.

Problem/issue: Country flags are not displayed in website/browser.
Another similar issue is that the anonymous or better mystery man (mm) which is used as an avatar is also not displayed. ;)

Following error occurs by opening the .svg file in browser (Firefox 56, IE 11, Edge, Safari):
Code:
Content-Encoding Error

The Web page that you want to open can not be displayed because it uses an invalid or unknown form of compression. Please, contact webmaster...

So, we can assume that it is a compression error.

By sorce code we can see what Pagespeed does with the file which is loaded by javascript.:
Code:
<li class="menuOverlayItem" data-more="com.woltlab.wcf.language" data-language-code="en" data-language-id="2">
                                <a href="#" class="menuOverlayItemLink box24">
                                    <img src="https://www.example.com/icon/flag/gb.svg" alt="" data-pagespeed-url-hash="2172445665" onload="pagespeed.CriticalImages.checkImageForCriticality(this);">
                                    <span class="menuOverlayItemTitle">English</span>
                                </a>
                            </li>

The .svg image file is loaded by javascript which could be also an additional possibility for the issue or perhaps my own pagespeed handler misconfiguration.
Important: The best would be minimal configuration changes which do not affect other optimizations.

Here is my pagespeed configuration in /etc/nginx/nginx.conf.
Code:
    pagespeed on;
    pagespeed FileCachePath /var/ngx_pagespeed_cache;
    pagespeed FileCacheSizeKb 409600;
    pagespeed FileCacheCleanIntervalMs 3600000;
    pagespeed FileCacheInodeLimit 500000;
    pagespeed LRUCacheKbPerProcess 8192;
    pagespeed LRUCacheByteLimit 16384;
    pagespeed CreateSharedMemoryMetadataCache "/var/ngx_pagespeed_cache/" 51200;
                 
    pagespeed Statistics on;
    pagespeed StatisticsLogging on;
    pagespeed LogDir /var/log/pagespeed;
    pagespeed AdminPath /pagespeed_admin;
    pagespeed GlobalAdminPath /pagespeed_global_admin;
    pagespeed StatisticsPath /ngx_pagespeed_statistics;
    pagespeed GlobalStatisticsPath /ngx_pagespeed_global_statistics;
    pagespeed MessagesPath /ngx_pagespeed_message;
    pagespeed ConsolePath /pagespeed_console;
    pagespeed UsePerVhostStatistics on;
    pagespeed MessageBufferSize 100000;
    pagespeed EnableCachePurge on;

    pagespeed StatisticsDomains Disallow *;
    pagespeed GlobalStatisticsDomains Disallow *;
    pagespeed MessagesDomains Disallow *;
    pagespeed ConsoleDomains Disallow *;
    pagespeed AdminDomains Disallow *;
    pagespeed GlobalAdminDomains Disallow *;

    pagespeed StatisticsDomains Allow admin.example.com;
    pagespeed GlobalStatisticsDomains Allow admin.example.com;
    pagespeed MessagesDomains Allow admin.example.com;
    pagespeed ConsoleDomains Allow admin.example.com;
    pagespeed AdminDomains Allow admin.example.com;
    pagespeed GlobalAdminDomains Allow admin.example.com;

    pagespeed EnableFilters combine_css,combine_javascript;
    pagespeed PreserveUrlRelativity on;
    pagespeed StaticAssetPrefix /static/;
    pagespeed EnableFilters insert_dns_prefetch;

    # BEGIN Google brotli - definitions, tuned by UFHH01
    brotli on;
    brotli_static on;
    brotli_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript image/x-icon image/bmp image/svg+xml image/gif image/jpeg application/atom+xml application/javascript image/png image/tiff image/x-ms-bmp application/font-woff application/json application/msword application/pdf application/postscript application/rtf application/vnd.apple.mpegurl application/vnd.ms-excel application/vnd.ms-fontobject application/vnd.ms-powerpoint application/vnd.wap.wmlc application/vnd.google-earth.kml+xml application/vnd.google-earth.kmz application/x-7z-compressed application/x-cocoa application/x-java-archive-diff application/x-perl application/x-rar-compressed application/x-shockwave-flash application/x-tcl application/x-x509-ca-cert application/xhtml+xml application/xspf+xml application/zip application/octet-stream audio/midi audio/mpeg audio/ogg audio/x-m4a audio/x-realaudio video/3gpp video/mp2t video/mp4 video/mpeg video/quicktime video/webm video/x-flv video/x-m4v video/x-mng video/x-ms-asf video/x-ms-wmv video/x-msvideo;
    brotli_comp_level 8;
    # END Google brotli - definitions, tuned by UFHH01

    # BEGIN gzip - Definitions, tuned by UFHH01
    gzip_static on;
    gzip on;
    gzip_proxied any;
    gzip_http_version 1.1;
    gzip_min_length 100;
    gzip_vary on;
    gzip_comp_level 6;
    gzip_buffers 16 8k;
    gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript image/x-icon image/bmp image/svg+xml image/gif image/jpeg application/atom+xml application/javascript image/png image/tiff image/x-ms-bmp application/font-woff application/json application/msword application/pdf application/postscript application/rtf application/vnd.apple.mpegurl application/vnd.ms-excel application/vnd.ms-fontobject application/vnd.ms-powerpoint application/vnd.wap.wmlc application/vnd.google-earth.kml+xml application/vnd.google-earth.kmz application/x-7z-compressed application/x-cocoa application/x-java-archive-diff application/x-perl application/x-rar-compressed application/x-shockwave-flash application/x-tcl application/x-x509-ca-cert application/xhtml+xml application/xspf+xml application/zip application/octet-stream audio/midi audio/mpeg audio/ogg audio/x-m4a audio/x-realaudio video/3gpp video/mp2t video/mp4 video/mpeg video/quicktime video/webm video/x-flv video/x-m4v video/x-mng video/x-ms-asf video/x-ms-wmv video/x-msvideo;
    gzip_disable "MSIE [1-6]\.(?!.*SV1)";
    # END gzip - Definitions, tuned by UFHH01

Help would be great to fix this error.
Greets
 
Last edited:
Thank you @UFHH01 for your help.
Since a two days I realized something strange:
Like you suggested here I flushed the entire cache or the vhost refering cache several times during last weeks after other configurations changes and tests to find the best way.
THEN in Internetexplorer 11 and EDGE the flags appear after some time, minimum one day mostly longer. Most times not in Firefox and Safari.
Sometimes only in Firefox. I got crazy about it.
So, I use your suggestion only in one Woltlab community, flush the cache and we will see the result.
Since one week I also stopped using tmpfs for /var/ngx_pagespeed.
Greets
 
Last edited:
Back
Top