[英]Is it possible to set Brotli compression level dynamically based on the request headers in Nginx?
I'm using Brotli for response compression, and doing this in Nginx using nginx-brotli module .我正在使用 Brotli 进行响应压缩,并使用nginx-brotli 模块在 Nginx 中执行此操作。
I would like to set the value for brotli_comp_level
dynamically based on the request headers, so that clients on slow networks could request higher compression.我想根据请求标头动态设置
brotli_comp_level
的值,以便慢速网络上的客户端可以请求更高的压缩。 How can I achieve this?我怎样才能做到这一点?
I tried to no avail:我试过无济于事:
http {
...
brotli on;
brotli_comp_level 6;
brotli_types *;
if ($http_x_brotli_high_quality) {
brotli_comp_level 11;
}
}
It is not possible with the stock/packaged Brotli module from NGINX Plus. NGINX Plus 的库存/打包 Brotli 模块是不可能的。
You can, however, custom compile (not recommended for production) with the following pull request integrated.但是,您可以自定义编译(不推荐用于生产)并集成以下拉取请求。
Or, if the budget allows, use the nginx-module-brotli
module package from NGINX Extras , which has the aforementioned pull request integrated into the packages.或者,如果预算允许,请使用NGINX Extras 中的
nginx-module-brotli
模块包,它将上述拉取请求集成到包中。 This option requires a CentOS/RHEL machine and maintaining a paid subscription with GetPageSpeed.此选项需要 CentOS/RHEL 机器并使用 GetPageSpeed 维护付费订阅。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.