chore: update dev host

This commit is contained in:
duorameng
2026-05-14 09:02:16 +08:00
parent c211a19dd8
commit d08a53f2b2
2 changed files with 9 additions and 6 deletions
+5 -2
View File
@@ -49,8 +49,11 @@ func CheckWSOrigin(r *http.Request) bool {
}
}
// 3. 允许来自 localhost127.0.0.1 的请求 (方便本地开发和同机部署)
if strings.HasPrefix(u.Host, "localhost") || strings.HasPrefix(u.Host, "127.0.0.1") {
// 3. 允许来自 localhost127.0.0.1 以及局域网内网 IP 的请求 (方便本地开发、虚拟机调试和局域网部署)
hostname := u.Hostname()
if strings.HasPrefix(hostname, "localhost") || strings.HasPrefix(hostname, "127.0.0.1") ||
strings.HasPrefix(hostname, "192.168.") || strings.HasPrefix(hostname, "10.") ||
strings.HasPrefix(hostname, "172.") {
return true
}