mirror of
https://github.com/dogkeeper886/ollama37.git
synced 2025-12-10 15:57:04 +00:00
server: lowercase hostname for Host header check (#5851)
This commit is contained in:
@@ -1071,11 +1071,13 @@ func isLocalIP(ip netip.Addr) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func allowedHost(host string) bool {
|
func allowedHost(host string) bool {
|
||||||
|
host = strings.ToLower(host)
|
||||||
|
|
||||||
if host == "" || host == "localhost" {
|
if host == "" || host == "localhost" {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if hostname, err := os.Hostname(); err == nil && host == hostname {
|
if hostname, err := os.Hostname(); err == nil && host == strings.ToLower(hostname) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user