mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-02-23 04:53:10 -06:00
🐛 Do not store proxy ips as device's ip.
This commit is contained in:
parent
c40555c836
commit
90e2b5cecc
|
|
@ -240,7 +240,8 @@ func MakeExternalAPI(metricsName string, f func(*http.Request) util.JSONResponse
|
||||||
defer span.Finish()
|
defer span.Finish()
|
||||||
req = req.WithContext(opentracing.ContextWithSpan(req.Context(), span))
|
req = req.WithContext(opentracing.ContextWithSpan(req.Context(), span))
|
||||||
if forwardedFor := req.Header.Get("X-Forwarded-For"); forwardedFor != "" {
|
if forwardedFor := req.Header.Get("X-Forwarded-For"); forwardedFor != "" {
|
||||||
req.RemoteAddr = forwardedFor
|
ips := strings.Split(forwardedFor, ", ")
|
||||||
|
req.RemoteAddr = ips[0]
|
||||||
}
|
}
|
||||||
h.ServeHTTP(nextWriter, req)
|
h.ServeHTTP(nextWriter, req)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -192,7 +192,8 @@ func (rp *RequestPool) updateLastSeen(req *http.Request, device *userapi.Device)
|
||||||
}
|
}
|
||||||
|
|
||||||
if forwardedFor := req.Header.Get("X-Forwarded-For"); forwardedFor != "" {
|
if forwardedFor := req.Header.Get("X-Forwarded-For"); forwardedFor != "" {
|
||||||
req.RemoteAddr = forwardedFor
|
ips := strings.Split(forwardedFor, ", ")
|
||||||
|
req.RemoteAddr = ips[0]
|
||||||
}
|
}
|
||||||
remoteAddr := req.RemoteAddr
|
remoteAddr := req.RemoteAddr
|
||||||
if rp.cfg.RealIPHeader != "" {
|
if rp.cfg.RealIPHeader != "" {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue