Get up and running with Kimi, GLM, MiniMax, DeepSeek, gpt-oss, Qwen, Gemma and other models.
Add preflight OPTIONS handling and update CORS config (#4086)
Bruce MacDonaldcef45feaa4bb
diff --git a/server/routes.go b/server/routes.goindex e04592710..7dfeb5139 100644--- a/server/routes.go+++ b/server/routes.go@@ -935,6 +935,11 @@ func allowedHostsMiddleware(addr net.Addr) gin.HandlerFunc {}if allowedHost(host) {+ if c.Request.Method == "OPTIONS" {+ c.AbortWithStatus(http.StatusNoContent)+ return+ }+c.Next()return}@@ -947,6 +952,7 @@ func (s *Server) GenerateRoutes() http.Handler {config := cors.DefaultConfig()config.AllowWildcard = trueconfig.AllowBrowserExtensions = true+ config.AllowHeaders = []string{"Authorization", "Content-Type", "User-Agent", "Accept", "X-Requested-With"}config.AllowOrigins = envconfig.AllowOriginsr := gin.Default()