mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-12 18:26:36 +08:00
fix(cache): 存量空/url 策略规范为 all,避免静默收窄
评审修复:enabled 且 policy 为空或 url 时,写入/展示/快照/渲染均映射为 all, 保证旧站点宽缓存范围不变;新建 UI 仍显式提交 static 作为推荐默认。
This commit is contained in:
@@ -335,12 +335,17 @@ export function buildPayloadFromRoute(
|
||||
limit_conn_per_ip: route.limit_conn_per_ip,
|
||||
limit_rate: route.limit_rate,
|
||||
cache_enabled: route.cache_enabled,
|
||||
cache_policy:
|
||||
!route.cache_policy || route.cache_policy === 'url'
|
||||
? route.cache_policy === 'url'
|
||||
? 'all'
|
||||
: 'static'
|
||||
: route.cache_policy,
|
||||
cache_policy: (() => {
|
||||
if (!route.cache_enabled) {
|
||||
return 'static';
|
||||
}
|
||||
const policy = (route.cache_policy || '').trim();
|
||||
// Legacy empty/url → all (same as backend displayCachePolicy).
|
||||
if (!policy || policy === 'url' || policy === 'all') {
|
||||
return 'all';
|
||||
}
|
||||
return policy;
|
||||
})(),
|
||||
cache_rules: route.cache_rule_list ?? [],
|
||||
custom_headers: route.custom_header_list ?? [],
|
||||
basic_auth_enabled: route.basic_auth_enabled,
|
||||
|
||||
Reference in New Issue
Block a user