Skip to content

Commit 2b1023f

Browse files
committed
net/http/httputil: docs about X-Forwarded-For in ReverseProxy
1 parent 71239b4 commit 2b1023f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/net/http/httputil/reverseproxy.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@ import (
2424
// ReverseProxy is an HTTP Handler that takes an incoming request and
2525
// sends it to another server, proxying the response back to the
2626
// client.
27+
// ReverseProxy automatically sets the client IP as value of the
28+
// X-Forwarded-For header.
29+
// If a X-Forwarded-For header already exists, the client IP is
30+
// appended to existing values.
31+
// To prevent IP spoofing, be sure to delete any pre-existing
32+
// X-Forwarded-For header comming from the client or
33+
// an untrusted proxy.
2734
type ReverseProxy struct {
2835
// Director must be a function which modifies
2936
// the request into a new request to be sent

0 commit comments

Comments
 (0)