litespeedtech / openlitespeed

Our high-performance, lightweight, open source HTTP server
https://openlitespeed.org
GNU General Public License v3.0
1.2k stars 194 forks source link

wrong header set when loading pre compressed js or css files #384

Open Orgoth opened 7 months ago

Orgoth commented 7 months ago

Joomla 5 delivers already compressed files, but openlitespeed does not set the headers as it should be.

Selection_003

/public_html/media/plg_system_guidedtours/js/guidedtours.min.js.gz /public_html/media/plg_system_guidedtours/js/guidedtours.min.js

Openlitespeed reads the .gz and delivers the content without the needed header "Content-Encoding: gzip" Changing the tuning settings does not help in any way.

Orgoth commented 7 months ago

https://github.com/joomla/joomla-cms/issues/38028 OpenLiteSpeed ignores the restriction and parses the rewrite rules within and leads to broken Joomla-Backends. https://github.com/joomla/joomla-cms/blob/4.4-dev/htaccess.txt#L139

Orgoth commented 1 month ago

The Google Group is also dead in the water, the developers don't care at all.

Swiched back to nginx and apache, since the developers are completely unable to fix such a simple problem.

Simply ignore all ifmodule blocks which are not rewrite to prevent breaking applications like joomla.

Example:

<IfModule mod_headers.c>
    # Serve gzip compressed CSS files if they exist
    # and the client accepts gzip.
    RewriteCond "%{HTTP:Accept-encoding}" "gzip"
    RewriteCond "%{REQUEST_FILENAME}\.gz" -s
    RewriteRule "^(.*)\.css" "$1\.css\.gz" [QSA]

    # Serve gzip compressed JS files if they exist
    # and the client accepts gzip.
    RewriteCond "%{HTTP:Accept-encoding}" "gzip"
    RewriteCond "%{REQUEST_FILENAME}\.gz" -s
    RewriteRule "^(.*)\.js" "$1\.js\.gz" [QSA]

    # Serve correct content types, and prevent mod_deflate double compression.
    RewriteRule "\.css\.gz$" "-" [T=text/css,E=no-gzip:1,E=no-brotli:1]
    RewriteRule "\.js\.gz$" "-" [T=text/javascript,E=no-gzip:1,E=no-brotli:1]

    <FilesMatch "(\.js\.gz|\.css\.gz)$">
        # Serve correct encoding type.
        Header set Content-Encoding gzip

        # Force proxies to cache gzipped &
        # non-gzipped css/js files separately.
        Header append Vary Accept-Encoding
    </FilesMatch>
</IfModule>

At the moment we are recommending all customers to not use openlitespeed at all.