vue-vben-admin icon indicating copy to clipboard operation
vue-vben-admin copied to clipboard

Bug: 部署nginx 启用brotli 当启用brotli_static no; 会报错 net::ERR_CONTENT_DECODING_FAILED 200 (OK)

Open wangz-code opened this issue 1 year ago • 1 comments

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)

image

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

wangz-code avatar Sep 24 '24 08:09 wangz-code

我测试在 vite.config.mts 配置中 使用rollup-plugin-gzip 打包后测试正常

build: {
        rollupOptions: {
          plugins: [
            gzipPlugin({
              customCompression: (content) => brotliPromise(Buffer.from(content)),
              fileName: '.br',
            }),
          ],
        },
      
      },

wangz-code avatar Sep 25 '24 02:09 wangz-code