Skip to content

Commit

Permalink
chore: proxy headers
Browse files Browse the repository at this point in the history
  • Loading branch information
unkn0wn-root committed Dec 31, 2024
1 parent 9a14cd6 commit 3c3240b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions internal/pool/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 3c3240b

Please sign in to comment.