From d4a8ce48a57bf84075a23b25cdab1c0276a6862b Mon Sep 17 00:00:00 2001 From: GoEdgeLab Date: Sun, 7 Aug 2022 16:37:29 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=93=E5=AD=98=E6=9D=A1=E4=BB=B6=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0If-None-Match=E5=92=8CIf-Modified-Since=E6=98=AF?= =?UTF-8?q?=E5=90=A6=E5=9B=9E=E6=BA=90=E9=80=89=E9=A1=B9=EF=BC=9B=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E4=B8=8D=E5=9B=9E=E6=BA=90=EF=BC=8C=E9=98=B2=E6=AD=A2?= =?UTF-8?q?=E6=BA=90=E7=AB=99=E8=BF=94=E5=9B=9E304?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/nodes/http_request.go | 4 ++-- internal/nodes/http_request_reverse_proxy.go | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/internal/nodes/http_request.go b/internal/nodes/http_request.go index 2a67c68..e1b5a58 100644 --- a/internal/nodes/http_request.go +++ b/internal/nodes/http_request.go @@ -1389,12 +1389,12 @@ func (this *HTTPRequest) Cookie(name string) string { return c.Value } -// DeleteHeader 删除Header +// DeleteHeader 删除请求Header func (this *HTTPRequest) DeleteHeader(name string) { this.RawReq.Header.Del(name) } -// SetHeader 设置Header +// SetHeader 设置请求Header func (this *HTTPRequest) SetHeader(name string, values []string) { this.RawReq.Header[name] = values } diff --git a/internal/nodes/http_request_reverse_proxy.go b/internal/nodes/http_request_reverse_proxy.go index adbcd22..051b3d7 100644 --- a/internal/nodes/http_request_reverse_proxy.go +++ b/internal/nodes/http_request_reverse_proxy.go @@ -70,6 +70,14 @@ func (this *HTTPRequest) doOriginRequest(failedOriginIds []int64, failedLnNodeId // 强制变更原来访问的域名 requestHost = this.ReqHost } + + // 回源Header中去除If-None-Match和If-Modified-Since + if !this.cacheRef.EnableIfNoneMatch { + this.DeleteHeader("If-None-Match") + } + if !this.cacheRef.EnableIfModifiedSince { + this.DeleteHeader("If-Modified-Since") + } } // 自定义源站