You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2021/04/28 09:53:47 UTC

[GitHub] [apisix-dashboard] starsz commented on a change in pull request #1831: fix: use remote address instead of client ip

starsz commented on a change in pull request #1831:
URL: https://github.com/apache/apisix-dashboard/pull/1831#discussion_r622016559



##########
File path: api/internal/filter/ip_filter.go
##########
@@ -81,7 +82,10 @@ func checkIP(ipStr string, ips map[string]bool, subnets []*subnet) bool {
 func IPFilter() gin.HandlerFunc {
 	ips, subnets := generateIPSet(conf.AllowList)
 	return func(c *gin.Context) {
-		ipStr := c.ClientIP()
+		var ipStr string
+		if ip, _, err := net.SplitHostPort(strings.TrimSpace(c.Request.RemoteAddr)); err == nil {

Review comment:
       Referer from gin:
   
   https://github.com/gin-gonic/gin/blob/ee4de846a894e9049321e809d69f4343f62d2862/context.go#L760-L763




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org