vue-vben-admin
vue-vben-admin copied to clipboard
Bug: 部署nginx 启用brotli 当启用brotli_static no; 会报错 net::ERR_CONTENT_DECODING_FAILED 200 (OK)
Version
Vben Admin V5
Describe the bug?
vue-vben-admin-5.3.0 https://github.com/vbenjs/vue-vben-admin/releases/tag/v5.3.0
.env.production
# 是否开启压缩,可以设置为 none, brotli, gzip
VITE_COMPRESS=brotli
npm run build:naive
nginx 配置
brotli on;
brotli_types text/plain text/css text/xml application/xml application/json text/javascript application/javascript application/x-javascript;
brotli_static on; #只要这里设置为 on 就会报错, off 就正常
brotli_comp_level 6;
访问就会提示 net::ERR_CONTENT_DECODING_FAILED 200 (OK)
Reproduction
null
System Info
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 11 (bullseye)
Release: 11
Codename: bullseye
nginx version: nginx/1.26.2
built with OpenSSL 1.1.1w 11 Sep 2023
TLS SNI support enabled
Relevant log output
No response
Validations
- [X] Read the docs
- [X] Ensure the code is up to date. (Some issues have been fixed in the latest version)
- [X] I have searched the existing issues and checked that my issue does not duplicate any existing issues.
- [X] Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- [X] The provided reproduction is a minimal reproducible example of the bug.
我测试在 vite.config.mts 配置中 使用rollup-plugin-gzip 打包后测试正常
build: {
rollupOptions: {
plugins: [
gzipPlugin({
customCompression: (content) => brotliPromise(Buffer.from(content)),
fileName: '.br',
}),
],
},
},