From b341548c2dcbc8b0a0c86d7381bc64aa49869d7c Mon Sep 17 00:00:00 2001 From: GoEdgeLab Date: Sun, 17 Oct 2021 20:22:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0PURGE=E6=9F=90=E4=B8=AAURL?= =?UTF-8?q?=E7=BC=93=E5=AD=98=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../server/http-cache-config-box.js | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/web/public/js/components/server/http-cache-config-box.js b/web/public/js/components/server/http-cache-config-box.js index c47a5e23..66534069 100644 --- a/web/public/js/components/server/http-cache-config-box.js +++ b/web/public/js/components/server/http-cache-config-box.js @@ -7,7 +7,9 @@ Vue.component("http-cache-config-box", { isPrior: false, isOn: false, addStatusHeader: true, - cacheRefs: [] + cacheRefs: [], + purgeIsOn: false, + purgeKey: "" } } return { @@ -17,6 +19,16 @@ Vue.component("http-cache-config-box", { methods: { isOn: function () { return ((!this.vIsLocation && !this.vIsGroup) || this.cacheConfig.isPrior) && this.cacheConfig.isOn + }, + generatePurgeKey: function () { + let r = Math.random().toString() + Math.random().toString() + let s = r.replace(/0\./g, "") + .replace(/\./g, "") + let result = "" + for (let i = 0; i < s.length; i++) { + result += String.fromCharCode(parseInt(s.substring(i, i + 1)) + ((Math.random() < 0.5) ? "a" : "A").charCodeAt(0)) + } + this.cacheConfig.purgeKey = result } }, template: `
@@ -51,6 +63,20 @@ Vue.component("http-cache-config-box", {

选中后自动在响应Header中增加X-Cache: BYPASS|MISS|HIT

+ + 允许PURGE + + +

允许使用PURGE方法清除某个URL缓存。

+ + + + PURGE Key * + + +

[随机生成]。需要在PURGE方法调用时加入Edge-Purge-Key: {{cacheConfig.purgeKey}} Header。只能包含字符、数字、下划线。

+ +