0

I'm pulling my hairs for days trying to serve brotli compressed files through my local nginx install.

My configuration :

  • MacOS 12.6, Homebrew, Laravel Valet for managing sites and ssl

  • default nginx install replaced with nginx-full homebrew formulae that allows recompiling nginx with modules -> installed with the brotli module

  • I have tried different nginx brotli configuration, like this one

  • I think I do not have to do this, but I still tried to add specific proxy configurations for the files I want served with brotli

    location ~ [^/]\.data\.br(/|$) {
      add_header Content-Encoding br;
      default_type application/octet-stream;
    }
    
    location ~ [^/]\.js\.br(/|$) {
      add_header Content-Encoding br;
      default_type application/javascript;
    }
    

In the end, the http response does not contain content-encoding:br

nginx shows the module is installed :

$ nginx -V 2>&1 | tr ' ' '\n' | egrep -i 'brotli'              
--add-module=/usr/local/share/brotli-nginx-module

When testing with curl it works for gzip but not for brotli :

HTTP/2 200 
server: nginx/1.23.1
date: Thu, 20 Oct 2022 09:57:20 GMT
content-type: text/html; charset=UTF-8
vary: Accept-Encoding
x-powered-by: PHP/8.1.10
access-control-allow-origin: *
content-encoding: gzip

HTTP/2 200 
server: nginx/1.23.1
date: Thu, 20 Oct 2022 09:57:21 GMT
content-type: text/html; charset=UTF-8
vary: Accept-Encoding
x-powered-by: PHP/8.1.10
access-control-allow-origin: *
HERE IT SHOULD BE "content-encoding: br" BUT IT'S NOT

Any idea is welcome, I don't understand what is going on... cheers.

Pierre
  • 4,976
  • 12
  • 54
  • 76

0 Answers0