From 9a5bd9bcba89ea8f17e7d68dc547b26360d4675b Mon Sep 17 00:00:00 2001
From: CityFun <31820853+zhengkunwang223@users.noreply.github.com>
Date: Tue, 15 Sep 2026 18:36:51 +0800
Subject: [PATCH] fix: Fix the issue where Brotli settings cannot be saved when
enabled in OpenResty (#13822)
---
.../website/nginx/performance/index.vue | 26 +++++++++----------
1 file changed, 12 insertions(+), 14 deletions(-)
diff --git a/frontend/src/views/website/website/nginx/performance/index.vue b/frontend/src/views/website/website/nginx/performance/index.vue
index 2069fc690..028f8febe 100644
--- a/frontend/src/views/website/website/nginx/performance/index.vue
+++ b/frontend/src/views/website/website/nginx/performance/index.vue
@@ -61,14 +61,14 @@
-
+
{{ $t('nginx.brotliHelper') }}
-
+
{{ unitLabel('brotli_min_length', 'k') }}
{{ $t('nginx.brotliMinLengthHelper') }}
@@ -76,7 +76,7 @@
-
+
{{ $t('nginx.brotliCompLevelHelper') }}
@@ -115,6 +115,9 @@ let form = ref({
gzip_min_length: 1,
gzip_comp_level: 2,
gzip: 'on',
+ brotli: 'on',
+ brotli_comp_level: 5,
+ brotli_min_length: 1,
});
let nginxFormRef = ref();
let loading = ref(false);
@@ -125,11 +128,6 @@ let loading = ref(false);
const brotliAvailable = ref(false);
const brotliManagedExternally = ref(false);
const brotliManagedUnavailable = ref(false);
-const brotliForm = ref({
- brotli: 'on',
- brotli_comp_level: 5,
- brotli_min_length: 1,
-});
const variablesRules = reactive({
server_names_hash_bucket_size: [checkNumberRange(1, 9999)],
@@ -209,11 +207,11 @@ const getBrotliParams = async () => {
continue;
}
if (param.name === 'brotli') {
- brotliForm.value.brotli = param.params[0];
+ form.value.brotli = param.params[0];
} else if (param.name === 'brotli_min_length') {
- brotliForm.value.brotli_min_length = parseSizeParam(param.name, param.params[0]);
+ form.value.brotli_min_length = parseSizeParam(param.name, param.params[0]);
} else if (param.name === 'brotli_comp_level') {
- brotliForm.value.brotli_comp_level = Number(param.params[0].match(/\d+/g)?.[0] ?? 0);
+ form.value.brotli_comp_level = Number(param.params[0].match(/\d+/g)?.[0] ?? 0);
}
}
};
@@ -246,9 +244,9 @@ const submit = async (formEl: FormInstance | undefined) => {
scope: 'brotli',
operate: 'update',
params: {
- brotli: brotliForm.value.brotli,
- brotli_comp_level: String(brotliForm.value.brotli_comp_level),
- brotli_min_length: withUnit('brotli_min_length', brotliForm.value.brotli_min_length, 'k'),
+ brotli: form.value.brotli,
+ brotli_comp_level: String(form.value.brotli_comp_level),
+ brotli_min_length: withUnit('brotli_min_length', form.value.brotli_min_length, 'k'),
},
}).catch(() => {
// gzip was already saved by the time brotli failed; say so