Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
5 tasks done
wangz-code opened this issue Sep 24, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@wangz-code
Copy link

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

@vince292007 vince292007 added the bug Something isn't working label Sep 25, 2024
@wangz-code
Copy link
Author

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants