Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion pkg/proxy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,12 @@ func (p *ProxyRouter) handleProxy(c *gin.Context) {
return
}

c.Request.Header = p.proxyHeaders
c.Request.Header.Del("Authorization")
for key, values := range p.proxyHeaders {
for _, value := range values {
c.Request.Header.Add(key, value)
Copy link

Copilot AI Aug 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current implementation always removes the Authorization header, but then may add it back if it exists in p.proxyHeaders. This could lead to duplicate Authorization headers if p.proxyHeaders contains an Authorization entry. Consider checking if the key is 'Authorization' and using Set instead of Add for that specific header, or remove Authorization from p.proxyHeaders before the loop.

Suggested change
c.Request.Header.Add(key, value)
if strings.EqualFold(key, "Authorization") {
c.Request.Header.Set(key, value)
} else {
c.Request.Header.Add(key, value)
}

Copilot uses AI. Check for mistakes.
}
}

p.proxy.ServeHTTP(c.Writer, c.Request)
}