Skip to content

Commit

Permalink
Fix get remote addr in node
Browse files Browse the repository at this point in the history
  • Loading branch information
zachhuff386 committed Feb 26, 2024
1 parent 067c0e6 commit 692aa92
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ func (n *Node) CommitFields(db *database.Database, fields set.Set) (
func (n *Node) GetRemoteAddr(r *http.Request) (addr string) {
if n.ForwardedForHeader != "" {
addr = strings.TrimSpace(
strings.SplitN(r.Header.Get(n.ForwardedForHeader), ",", 1)[0])
strings.SplitN(r.Header.Get(n.ForwardedForHeader), ",", 2)[0])
if addr != "" {
return
}
Expand All @@ -252,7 +252,7 @@ func (n *Node) SafeGetRemoteAddr(r *http.Request) (addr string,

if n.ForwardedForHeader != "" {
addr = strings.TrimSpace(
strings.SplitN(r.Header.Get(n.ForwardedForHeader), ",", 1)[0])
strings.SplitN(r.Header.Get(n.ForwardedForHeader), ",", 2)[0])
if addr != "" {
header = true
valid = true
Expand Down

0 comments on commit 692aa92

Please sign in to comment.