I want to gain a clear understanding of the module ngx_brotli's directives. Specifically I need to understand, how brotli_static works. If brotli is off, I expect that the value of brotli_static will be ignored. Is this correct? How I imagine the behaviour, is that files will be compressed once, then the precompressed files will be served, if both brotli and brotli_static are on. If only brotli is on but brotli_static is off, I expect that files will be compressed anew, each time they are requested.
I compiled nginx with the ngx_brotli module. So far there are no apparent errors, but I want to make sure everything is set up correcty. My setup looks as follows:
http {
brotli off;
brotli_static on;
brotli_types *;
...
server {
...
location xyz {
brotli on;
}
}
}
If brotli is off, I expect that the value of brotli_static will be ignored. Is this correct?
No, if brotli off;
is set, it has no influence on the brotli_static
setting. The reason being is that ngx_brotli
actually consists of two modules (1 - filter and 2 - static).
The brotli
directive controls on-the fly compression, it belongs to the filter module.
The brotli_static
controls whether pre-compressed files are looked up and used. It belongs to the static module.
So thus configuration like the following is perfectly valid and usable when you have precompressed files and don't want to spend CPU on dynamic compression:
brotli off;
brotli_static on;