缓存条件增加“强制Range回源选项”

This commit is contained in:
GoEdgeLab
2023-07-31 17:31:42 +08:00
parent 0bc8e75e1f
commit fd060c65d0
3 changed files with 18 additions and 9 deletions

View File

@@ -150,7 +150,7 @@ Vue.component("http-cache-ref-box", {
} }
switch (condCategory) { switch (condCategory) {
case "simple": case "simple":
dialog.style.width = "40em" dialog.style.width = "45em"
break break
case "complex": case "complex":
let width = window.parent.innerWidth let width = window.parent.innerWidth
@@ -267,13 +267,6 @@ Vue.component("http-cache-ref-box", {
<p class="comment">内容尺寸如果低于此值则不缓存。</p> <p class="comment">内容尺寸如果低于此值则不缓存。</p>
</td> </td>
</tr> </tr>
<tr v-show="moreOptionsVisible && !vIsReverse">
<td>支持分段内容</td>
<td>
<checkbox name="allowChunkedEncoding" value="1" v-model="ref.allowChunkedEncoding"></checkbox>
<p class="comment">选中后Gzip等压缩后的Chunked内容可以直接缓存无需检查内容长度。</p>
</td>
</tr>
<tr v-show="moreOptionsVisible && !vIsReverse"> <tr v-show="moreOptionsVisible && !vIsReverse">
<td>支持缓存分片内容</td> <td>支持缓存分片内容</td>
<td> <td>
@@ -281,13 +274,20 @@ Vue.component("http-cache-ref-box", {
<p class="comment">选中后,支持缓存源站返回的某个分片的内容,该内容通过<code-label>206 Partial Content</code-label>状态码返回。</p> <p class="comment">选中后,支持缓存源站返回的某个分片的内容,该内容通过<code-label>206 Partial Content</code-label>状态码返回。</p>
</td> </td>
</tr> </tr>
<tr v-show="moreOptionsVisible && !vIsReverse && ref.allowPartialContent"> <tr v-show="moreOptionsVisible && !vIsReverse && ref.allowPartialContent && !ref.alwaysForwardRangeReques">
<td>强制返回分片内容</td> <td>强制返回分片内容</td>
<td> <td>
<checkbox name="forcePartialContent" value="1" v-model="ref.forcePartialContent"></checkbox> <checkbox name="forcePartialContent" value="1" v-model="ref.forcePartialContent"></checkbox>
<p class="comment">选中后,表示无论客户端是否发送<code-label>Range</code-label>报头,都会优先尝试返回已缓存的分片内容;如果你的应用有不支持分片内容的客户端(比如有些下载软件不支持<code-label>206 Partial Content</code-label>),请务必关闭此功能。</p> <p class="comment">选中后,表示无论客户端是否发送<code-label>Range</code-label>报头,都会优先尝试返回已缓存的分片内容;如果你的应用有不支持分片内容的客户端(比如有些下载软件不支持<code-label>206 Partial Content</code-label>),请务必关闭此功能。</p>
</td> </td>
</tr> </tr>
<tr v-show="moreOptionsVisible && !vIsReverse">
<td>强制Range回源</td>
<td>
<checkbox v-model="ref.alwaysForwardRangeRequest"></checkbox>
<p class="comment">选中后表示把所有包含Range报头的请求都转发到源站而不是尝试从缓存中读取。</p>
</td>
</tr>
<tr v-show="moreOptionsVisible && !vIsReverse"> <tr v-show="moreOptionsVisible && !vIsReverse">
<td>状态码列表</td> <td>状态码列表</td>
<td> <td>
@@ -343,6 +343,13 @@ Vue.component("http-cache-ref-box", {
<p class="comment">试验功能。允许客户端中断连接后,仍然继续尝试从源站读取内容并缓存。</p> <p class="comment">试验功能。允许客户端中断连接后,仍然继续尝试从源站读取内容并缓存。</p>
</td> </td>
</tr> </tr>
<tr v-show="moreOptionsVisible && !vIsReverse">
<td>支持分段内容</td>
<td>
<checkbox name="allowChunkedEncoding" value="1" v-model="ref.allowChunkedEncoding"></checkbox>
<p class="comment">选中后Gzip等压缩后的Chunked内容可以直接缓存无需检查内容长度。</p>
</td>
</tr>
<tr v-show="false"> <tr v-show="false">
<td colspan="2"><input type="hidden" name="cacheRefJSON" :value="JSON.stringify(ref)"/></td> <td colspan="2"><input type="hidden" name="cacheRefJSON" :value="JSON.stringify(ref)"/></td>
</tr> </tr>

View File

@@ -56,6 +56,7 @@ Vue.component("http-cache-refs-box", {
<grey-label v-if="cacheRef.expiresTime != null && cacheRef.expiresTime.isPrior && cacheRef.expiresTime.isOn">Expires</grey-label> <grey-label v-if="cacheRef.expiresTime != null && cacheRef.expiresTime.isPrior && cacheRef.expiresTime.isOn">Expires</grey-label>
<grey-label v-if="cacheRef.status != null && cacheRef.status.length > 0 && (cacheRef.status.length > 1 || cacheRef.status[0] != 200)">状态码:{{cacheRef.status.map(function(v) {return v.toString()}).join(", ")}}</grey-label> <grey-label v-if="cacheRef.status != null && cacheRef.status.length > 0 && (cacheRef.status.length > 1 || cacheRef.status[0] != 200)">状态码:{{cacheRef.status.map(function(v) {return v.toString()}).join(", ")}}</grey-label>
<grey-label v-if="cacheRef.allowPartialContent">分片缓存</grey-label> <grey-label v-if="cacheRef.allowPartialContent">分片缓存</grey-label>
<grey-label v-if="cacheRef.alwaysForwardRangeRequest">Range回源</grey-label>
<grey-label v-if="cacheRef.enableIfNoneMatch">If-None-Match</grey-label> <grey-label v-if="cacheRef.enableIfNoneMatch">If-None-Match</grey-label>
<grey-label v-if="cacheRef.enableIfModifiedSince">If-Modified-Since</grey-label> <grey-label v-if="cacheRef.enableIfModifiedSince">If-Modified-Since</grey-label>
<grey-label v-if="cacheRef.enableReadingOriginAsync">支持异步</grey-label> <grey-label v-if="cacheRef.enableReadingOriginAsync">支持异步</grey-label>

View File

@@ -189,6 +189,7 @@ Vue.component("http-cache-refs-config-box", {
<grey-label v-if="cacheRef.expiresTime != null && cacheRef.expiresTime.isPrior && cacheRef.expiresTime.isOn">Expires</grey-label> <grey-label v-if="cacheRef.expiresTime != null && cacheRef.expiresTime.isPrior && cacheRef.expiresTime.isOn">Expires</grey-label>
<grey-label v-if="cacheRef.status != null && cacheRef.status.length > 0 && (cacheRef.status.length > 1 || cacheRef.status[0] != 200)">状态码:{{cacheRef.status.map(function(v) {return v.toString()}).join(", ")}}</grey-label> <grey-label v-if="cacheRef.status != null && cacheRef.status.length > 0 && (cacheRef.status.length > 1 || cacheRef.status[0] != 200)">状态码:{{cacheRef.status.map(function(v) {return v.toString()}).join(", ")}}</grey-label>
<grey-label v-if="cacheRef.allowPartialContent">分片缓存</grey-label> <grey-label v-if="cacheRef.allowPartialContent">分片缓存</grey-label>
<grey-label v-if="cacheRef.alwaysForwardRangeRequest">Range回源</grey-label>
<grey-label v-if="cacheRef.enableIfNoneMatch">If-None-Match</grey-label> <grey-label v-if="cacheRef.enableIfNoneMatch">If-None-Match</grey-label>
<grey-label v-if="cacheRef.enableIfModifiedSince">If-Modified-Since</grey-label> <grey-label v-if="cacheRef.enableIfModifiedSince">If-Modified-Since</grey-label>
<grey-label v-if="cacheRef.enableReadingOriginAsync">支持异步</grey-label> <grey-label v-if="cacheRef.enableReadingOriginAsync">支持异步</grey-label>