Magento-nginx-config icon indicating copy to clipboard operation
Magento-nginx-config copied to clipboard

Using Brotli/Gzip with Varnish 6

Open Amadeco opened this issue 2 years ago • 1 comments

Good afternoon,

Thank you for your work and for kindly submitted your project freely.

I just would like to take some informations from you, why you pass to the Varnish proxy the directives :

proxy_set_header Accept-Encoding "";
proxy_set_header Connection "";

As you may know, and sure you do, Brotli is more and more supported by recent navigators. And it has tremendous effect on the compression (15 to 20 points better than GZIP). When Brotli is supported, the navigator send an Accept-Encoding to "br" otherwise it gracefully send a "gzip" information to the server.

In particular, to make it work with Varnish (standard version), we need to retrieve the br information from the Accept-Encoding header.

And I do know the interest of the two directives below. It is not included in my research on most config Nginx + Varnish.

Do you see any particular issue who we will encounter if it is commented ?

Brotli is enabled for the compression request (http directive in nginx) but also enable for compressing caching object in Varnish. And so far, I have some results in term of speed (I did not test in term of load of the CPU though).

I am looking forward for your answer.

Ilan Parmentier

Amadeco avatar Mar 29 '22 11:03 Amadeco

I did a little bit of research for proxy_set_header Connection "";

You enable keepalive connections with this line.

Amadeco avatar Mar 30 '22 12:03 Amadeco