Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add X-Forwarded-For #597

Merged
merged 1 commit into from
Jan 23, 2025
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
3 changes: 3 additions & 0 deletions rpc/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,9 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
connInfo.HTTP.UserAgent = r.Header.Get("User-Agent")
ctx := r.Context()
ctx = context.WithValue(ctx, peerInfoContextKey{}, connInfo)
if xForward := r.Header.Get("X-Forwarded-For"); xForward != "" {
ctx = context.WithValue(ctx, "X-Forwarded-For", xForward)
}

// All checks passed, create a codec that reads directly from the request body
// until EOF, writes the response to w, and orders the server to process a
Expand Down
Loading