Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

鉴权兼容 IPv6 本机回环地址 (#6400)

颖逸a6e9199d88dd
diff --git a/kernel/model/session.go b/kernel/model/session.go
index b82dd6c447..b4607454ca 100644
--- a/kernel/model/session.go
+++ b/kernel/model/session.go
@@ -171,8 +171,10 @@ func CheckAuth(c *gin.Context) {
}
// 放过来自本机的某些请求
- if strings.HasPrefix(c.Request.RemoteAddr, util.LocalHost) || strings.HasPrefix(c.Request.RemoteAddr, "127.0.0.1") {
- if strings.HasPrefix(c.Request.RequestURI, "/assets/") || strings.HasPrefix(c.Request.RequestURI, "/history/assets/") {
+ if strings.HasPrefix(c.Request.RemoteAddr, util.LocalHost) ||
+ strings.HasPrefix(c.Request.RemoteAddr, "127.0.0.1") ||
+ strings.HasPrefix(c.Request.RemoteAddr, "[::1]") {
+ if strings.HasPrefix(c.Request.RequestURI, "/assets/") {
c.Next()
return
}