fix(api): 仅信任配置的反向代理转发客户端 IP (#39)
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
@@ -133,7 +133,7 @@ func presentedKey(r *http.Request) string {
|
||||
return ""
|
||||
}
|
||||
|
||||
// clientIP returns the caller IP, preferring chi's RealIP-normalized RemoteAddr.
|
||||
// clientIP returns the caller IP from the trusted-proxy-normalized RemoteAddr.
|
||||
func clientIP(r *http.Request) string {
|
||||
if host, _, err := net.SplitHostPort(r.RemoteAddr); err == nil {
|
||||
return host
|
||||
|
||||
Reference in New Issue
Block a user