Browse Source

server: lowercase hostname for Host header check (#5851)

frob 4 months ago
parent
commit
757eeacc1b
1 changed files with 3 additions and 1 deletions
  1. 3 1
      server/routes.go

+ 3 - 1
server/routes.go

@@ -1071,11 +1071,13 @@ func isLocalIP(ip netip.Addr) bool {
 }
 
 func allowedHost(host string) bool {
+	host = strings.ToLower(host)
+
 	if host == "" || host == "localhost" {
 		return true
 	}
 
-	if hostname, err := os.Hostname(); err == nil && host == hostname {
+	if hostname, err := os.Hostname(); err == nil && host == strings.ToLower(hostname) {
 		return true
 	}