Skip to content

Commit 7ef888a

Browse files
committed
fix: localhost IPv6 in IP whitelist middleware
1 parent f67bff7 commit 7ef888a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

internal/middleware/ip_whitelist.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
package middleware
22

33
import (
4+
"net/http"
5+
46
"github.com/0xJacky/Nginx-UI/settings"
57
"github.com/gin-gonic/gin"
68
"github.com/samber/lo"
7-
"net/http"
89
)
910

1011
func IPWhiteList() gin.HandlerFunc {
1112
return func(c *gin.Context) {
1213
clientIP := c.ClientIP()
13-
if len(settings.AuthSettings.IPWhiteList) == 0 || clientIP == "127.0.0.1" {
14+
if len(settings.AuthSettings.IPWhiteList) == 0 || clientIP == "127.0.0.1" || clientIP == "::1" {
1415
c.Next()
1516
return
1617
}

0 commit comments

Comments
 (0)