Sfoglia il codice sorgente

fix: allow all origins (close #20)

JustSong 2 anni fa
parent
commit
e7a809b082
1 ha cambiato i file con 3 aggiunte e 0 eliminazioni
  1. 3 0
      middleware/cors.go

+ 3 - 0
middleware/cors.go

@@ -8,5 +8,8 @@ import (
 func CORS() gin.HandlerFunc {
 	config := cors.DefaultConfig()
 	config.AllowAllOrigins = true
+	config.AllowCredentials = true
+	config.AllowMethods = []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"}
+	config.AllowHeaders = []string{"Origin", "Content-Length", "Content-Type", "Authorization", "Accept", "Connection"}
 	return cors.New(config)
 }