From b853fd03172e01f615d6b4af418ead703932b83f Mon Sep 17 00:00:00 2001 From: isayme Date: Fri, 13 Dec 2024 11:58:10 +0800 Subject: [PATCH] fix rewrite header name when SetOnResponse = true --- pkg/handler/rewrite/rewrite.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/handler/rewrite/rewrite.go b/pkg/handler/rewrite/rewrite.go index 5d7d9b4..2ae7f6e 100644 --- a/pkg/handler/rewrite/rewrite.go +++ b/pkg/handler/rewrite/rewrite.go @@ -81,7 +81,7 @@ func (r *Rewrite) Handle(rw http.ResponseWriter, req *http.Request) { for _, headerValue := range headerValues { replacedValue := r.replaceHeaderValue(headerValue) if r.rule.SetOnResponse { - rw.Header().Add(r.rule.Header, replacedValue) + rw.Header().Add(headerName, replacedValue) } else { header.Add(req, headerName, replacedValue) }