nginx 是在启用 Brotli 的情况下编译的。在我的 nginx.conf
http {
...
brotli_static on;
}
我的 .br 文件位于带有proxy_pass
.
location / {
...
proxy_pass http://app;
}
并且 .br 文件已在该app
服务器上生成:
$ ls -lh public/js/dist/index.js*
-rw-r--r-- 1 mike wheel 1.2M Apr 4 09:07 public/js/dist/index.js
-rw-r--r-- 1 mike wheel 201K Apr 4 09:07 public/js/dist/index.js.br
拉下未压缩文件的工作原理:
wget https://example.com/js/dist/index.js
拉下 1,157,704 大小的未压缩文件。
wget -S --header="accept-encoding: gzip" https://example.com/js/dist/index.js
拉下一个 309,360 大小的 gzip 文件。
但:
wget -S --header="accept-encoding: br" https://example.com/js/dist/index.js
仍然获得完整的 1,157,704 大小的未压缩文件。
我曾希望 brotli_static
也能代理 .br 文件请求 - 向后端发送 GET 请求以获取 .br 等效资源 - 但这似乎不起作用。
brotli_static 可以通过 proxy_pass 工作吗?