How to use Brotli ?

1

You can use 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 =====

Also Read

Create a development site with a subdomain

If your domain already uses our DNS, it's very simple : To make a demo shop with us from...

Recommended configuration with HA offers

Prestashop 1. Perf setting :MySQL Caching type : put File System 2. Modules to deactivate for...

OpenOffice - LibreOffice

With SSH you can test, it works and is the best solution to implement this command in your php...

How to configure a site with NGINX PHP-FPM

By default, your account works with PROXY NGINX mode (httpd) with Apache-LSAPI on Cloudlinux...

Backup and restore database in SSH

It is a fact, restore/import dense or important databases by phpmyadmin is not working or bad, it...