From 3c3240b5410a1d88a6d23a504f9f9b5e25e54b36 Mon Sep 17 00:00:00 2001 From: unkn0wn-root Date: Tue, 31 Dec 2024 09:04:41 +0100 Subject: [PATCH] chore: proxy headers --- internal/pool/proxy.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/internal/pool/proxy.go b/internal/pool/proxy.go index d3cd508..27eb3a9 100644 --- a/internal/pool/proxy.go +++ b/internal/pool/proxy.go @@ -175,9 +175,11 @@ func (p *URLRewriteProxy) updateRequestHeaders(req *http.Request) { req.Header.Set(HeaderXForwardedHost, originalHost) req.Header.Set(HeaderXForwardedFor, originalHost) - if p.headerHandler != nil { - p.headerHandler.ProcessRequestHeaders(req) + if p.headerHandler == nil { + return } + + p.headerHandler.ProcessRequestHeaders(req) } // handleRedirect processes HTTP redirect responses from the backend server. @@ -220,9 +222,11 @@ func (p *URLRewriteProxy) updateResponseHeaders(resp *http.Response) { resp.Header.Del(HeaderXPoweredBy) resp.Header.Set(HeaderXProxyBy, DefaultProxyLabel) - if p.headerHandler != nil { - p.headerHandler.ProcessResponseHeaders(resp) + if p.headerHandler == nil { + return } + + p.headerHandler.ProcessResponseHeaders(resp) } // isRedirect checks if the provided HTTP status code is one that indicates a redirection.