handle remote ip address in case of forwarding (#421)

Signed-off-by: shishir gowda <shishir@livekit.io>
This commit is contained in:
shishirng
2022-02-08 16:13:55 -05:00
committed by GitHub
parent 3117547d60
commit 562546829b
3 changed files with 7 additions and 1 deletions
+4 -1
View File
@@ -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 ||