fix(api): 仅信任配置的反向代理转发客户端 IP (#39)

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
fu500f
2026-10-31 00:44:04 +00:00
co-authored by Devin AI
parent 36f9c95fa7
commit 667e6d0f00
11 changed files with 373 additions and 15 deletions
+1 -1
View File
@@ -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