handle remote ip address in case of forwarding (#421)
Signed-off-by: shishir gowda <shishir@livekit.io>
This commit is contained in:
@@ -8,6 +8,8 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/sebest/xff"
|
||||
|
||||
"github.com/gorilla/websocket"
|
||||
"github.com/livekit/protocol/livekit"
|
||||
"github.com/livekit/protocol/logger"
|
||||
@@ -283,7 +285,8 @@ func (s *RTCService) ParseClientInfo(r *http.Request) *livekit.ClientInfo {
|
||||
ci.Browser = values.Get("browser")
|
||||
ci.BrowserVersion = values.Get("browser_version")
|
||||
ci.DeviceModel = values.Get("device_model")
|
||||
ci.Address = r.RemoteAddr
|
||||
// get real address (forwarded http header)
|
||||
ci.Address = xff.GetRemoteAddr(r)
|
||||
|
||||
// attempt to parse types for SDKs that support browser as a platform
|
||||
if ci.Sdk == livekit.ClientInfo_JS ||
|
||||
|
||||
Reference in New Issue
Block a user