From fa86f0cfdb5c5bef89f439ce010f821e1a278838 Mon Sep 17 00:00:00 2001 From: Gardel Date: Sun, 3 Jul 2022 20:24:30 +0800 Subject: [PATCH] fix "invalid session" when "prevent proxy connection" is on --- router/session_router.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/router/session_router.go b/router/session_router.go index 389e76d..cab10d6 100644 --- a/router/session_router.go +++ b/router/session_router.go @@ -56,7 +56,7 @@ func (s *sessionRouterImpl) JoinServer(c *gin.Context) { c.AbortWithStatusJSON(http.StatusForbidden, util.NewForbiddenOperationError(err.Error())) return } - ip := c.Request.RemoteAddr[:strings.LastIndexByte(c.Request.RemoteAddr, ':')] + ip := c.ClientIP() err = s.sessionService.JoinServer(request.AccessToken, request.ServerId, request.SelectedProfile, ip) if err != nil { util.HandleError(c, err)