AddEncoding gzip .gz

<FilesMatch "\.js\.gz$">
  ForceType text/javascript
  Header set Content-Encoding: gzip
</FilesMatch>

<FilesMatch "\.mem\.gz$">
  ForceType application/octet-stream
  Header set Content-Encoding: gzip
</FilesMatch>

<FilesMatch "\.data\.gz$">
  ForceType application/octet-stream
  Header set Content-Encoding: gzip
</FilesMatch>

<FilesMatch "\.wasm\.gz$">
  ForceType application/octet-stream
  Header set Content-Encoding: gzip
</FilesMatch>

RewriteEngine on 
RewriteCond %{HTTP:Accept-Encoding} gzip 
RewriteCond %{REQUEST_FILENAME}.gz -f 
RewriteRule ^(.+)\.(js|data|mem|wasm)$ $1.$2.gz [L] 