<IfModule mod_mime.c>
  # Make sure Brotli and gzip assets are served with the correct encoding
  AddEncoding br .br
  AddEncoding gzip .gz

  # Keep the original content types for pre-compressed Unity build files
  AddType application/javascript .js.br .js.gz
  AddType application/wasm .wasm.br .wasm.gz
  AddType application/octet-stream .data.br .data.gz .data
  AddType application/json .symbols.json.br .symbols.json.gz .symbols.json
</IfModule>

<IfModule mod_headers.c>
  # Tell browsers that .br/.gz files are already compressed so they get decompressed client-side
  <FilesMatch "\.(data|js|wasm|symbols\.json)\.br$">
    Header set Content-Encoding br
    Header set Cache-Control "public, max-age=31536000, immutable"
  </FilesMatch>

  <FilesMatch "\.(data|js|wasm|symbols\.json)\.gz$">
    Header set Content-Encoding gzip
    Header set Cache-Control "public, max-age=31536000, immutable"
  </FilesMatch>
</IfModule>
