diff --git a/internal/nodes/http_request.go b/internal/nodes/http_request.go index 77e67cd..f1540ca 100644 --- a/internal/nodes/http_request.go +++ b/internal/nodes/http_request.go @@ -1650,6 +1650,20 @@ func (this *HTTPRequest) processRequestHeaders(reqHeader http.Header) { } } } + + // 非标Header + if len(this.web.RequestHeaderPolicy.NonStandardHeaders) > 0 { + for _, name := range this.web.RequestHeaderPolicy.NonStandardHeaders { + var canonicalKey = http.CanonicalHeaderKey(name) + if canonicalKey != name { + v, ok := reqHeader[canonicalKey] + if ok { + delete(reqHeader, canonicalKey) + reqHeader[name] = v + } + } + } + } } } @@ -1749,6 +1763,20 @@ func (this *HTTPRequest) processResponseHeaders(responseHeader http.Header, stat } } + // 非标Header + if len(this.web.ResponseHeaderPolicy.NonStandardHeaders) > 0 { + for _, name := range this.web.ResponseHeaderPolicy.NonStandardHeaders { + var canonicalKey = http.CanonicalHeaderKey(name) + if canonicalKey != name { + v, ok := responseHeader[canonicalKey] + if ok { + delete(responseHeader, canonicalKey) + responseHeader[name] = v + } + } + } + } + // CORS if this.web.ResponseHeaderPolicy.CORS != nil && this.web.ResponseHeaderPolicy.CORS.IsOn && (!this.web.ResponseHeaderPolicy.CORS.OptionsMethodOnly || this.RawReq.Method == http.MethodOptions) { var corsConfig = this.web.ResponseHeaderPolicy.CORS