]> Cypherpunks repositories - gostls13.git/commit
net/http/httputil: add docs about X-Forwarded-For in ReverseProxy
authorKévin Dunglas <dunglas@gmail.com>
Tue, 21 Jan 2020 21:48:41 +0000 (21:48 +0000)
committerBrad Fitzpatrick <bradfitz@golang.org>
Tue, 21 Jan 2020 21:51:46 +0000 (21:51 +0000)
commit88ed322afcd8cddc0e1ae5d02fd4d86779a4a2a3
treefa5f51de778f27a426832740d16572fcafdcdfac
parent71239b4f491698397149868c88d2c851de2cd49b
net/http/httputil: add docs about X-Forwarded-For in ReverseProxy

ReverseProxy automatically sets the X-Forwarded-For header, if the request
already contains a X-Forwarded-For header, the value of the client IP is
appended to the existing header value.
This behavior isn't documented anywhere, and can lead to IP spoofing
security issues is the client is untrusted (the most common situation).
This PR documents this behavior.

For future versions, I proposed #36678 that implements a more secure
default behavior and adds support for other forwarded headers.

Change-Id: Ief14f5063caebfccb87714f54cffa927c714e5fd
GitHub-Last-Rev: fd0bd29a181861ffdb1106b42f59f9489999ccb3
GitHub-Pull-Request: golang/go#36672
Reviewed-on: https://go-review.googlesource.com/c/go/+/215617
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/net/http/httputil/reverseproxy.go