14th Oct 2020 - Deactivation of Brotli via Nginx
1

Hello,

Brotli is a data compression module when sending data between the server and the remote computer, and it claimed to replace Gzip, with a small speed boost of a few ms.

The Brotli module has recently presented compatibility and stability problems, and the latter is no longer maintained by the editor. We must therefore abandon it.

It's not a big loss. We will proceed with the activation of gzip / deactivation of brotli on all the accounts of our servers.

Anyway, we still have Brotli module inside Apache, and you can use it with PROXY mode of Nginx, by adding the code here after (customizable) : 

# BROTLI Dynamic - Server Generated on-the-fly

<ifmodule mod_brotli.c>

    AddOutputFilterByType BROTLI_COMPRESS text/plain text/xml text/css text/javascript application/javascript

</ifmodule>

<IfModule mod_headers.c>

# BROTLI Static - Precompressed

# Serve brotli compressed CSS and JS files if they exist and the client accepts brotli.

    RewriteCond "%{HTTP:Accept-encoding}" "br"

    RewriteCond "%{REQUEST_FILENAME}\.br" "-s"

    RewriteRule "^(.*)\.(js|css)"              "$1\.$2\.br" [QSA]

# Serve correct content types, and prevent double compression.

    RewriteRule "\.css\.br$" "-" [T=text/css,E=no-brotli:1,E=no-gzip:1]

    RewriteRule "\.js\.br$"  "-" [T=text/javascript,E=no-brotli:1,E=no-gzip:1]

  <FilesMatch "(\.js\.br|\.css\.br)$">

# Serve correct encoding type.

    Header append Content-Encoding br

# Cache Control and Enable CORS

    ExpiresActive On

    ExpiresDefault  "access plus 1 month"

    Header set Cache-Control "public, immutable, max-age=2628000, s-maxage=2628000"

    Header set Access-Control-Allow-Origin "*"

    Header append Vary Accept-Encoding

  </FilesMatch>

</IfModule>

# ===== END BROTLI =====

 

Thank you,

YOORshop team

Wednesday, October 14, 2020

« Back