denji / homebrew-nginx

:fire_engine: Community NGINX tap for custom modules
https://denji.github.io/homebrew-nginx/
Other
616 stars 197 forks source link

Brotli compression problem #413

Closed erralb closed 1 year ago

erralb commented 1 year ago

Indicate troubleshooting steps taken

Bug reports / build errors:

Brotli compression not working / Brotli header not added when serving files in the http response.

Brief summary of issue:

I'm not very experienced with nginx so I might have misconfigured something but I have trimple checked everything. I've installed nginx full with the Brotli module, the installation went fine and nginx is working as expected, but my files are not being served with the brotli header, even though I added this to my config :


  brotli on;
  brotli_comp_level 6;
  brotli_static on;
  brotli_types
  application/x-javascript
  text/xml
  application/xml+rss
  text/javascript
  image/x-icon
  image/vnd.microsoft.icon
  image/bmp
  image/svg+xml
  application/octet-stream
  application/octet-stream-compressible
  application/wasm

  application/atom+xml
  application/javascript
  application/json
  application/rss+xml
  application/vnd.ms-fontobject
  application/x-font-ttf
  application/x-web-app-manifest+json
  application/xhtml+xml
  application/xml
  font/opentype
  image/svg+xml
  image/x-icon
  text/css
  text/plain
  text/x-component
  ;

  location ~ .+\.data\.br$ {
    add_header Content-Encoding br;
    default_type application/octet-stream;
  }
  location ~ .+\.wasm\.br$ {
    add_header Content-Encoding br;
    default_type application/wasm;
  }
  location ~ .+\.js\.br$ {
    add_header Content-Encoding br;
    default_type application/javascript;
  }

But my .data.br and .js.br files do not have the br header in the http response and are not served correctly.

I saw here : https://denji.github.io/homebrew-nginx/ that the brotli module is this one : https://github.com/eustas/ngx_brotli and it seems old. I was wondering if the module should use the default Google repo instead ? Could that be the problem ? If so how can I make the install point to the Google repo instead of the old eustas one ?