You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
494 B
Go

7 months ago
package middleware
import (
"github.com/gin-contrib/cors"
"github.com/gin-gonic/gin"
"time"
)
func CorsMiddleware(module string) gin.HandlerFunc {
return cors.New(cors.Config{
7 months ago
AllowAllOrigins: true,
//AllowOrigins: []string{"*"},
AllowMethods: []string{"GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"},
AllowHeaders: []string{"Origin", "Content-Length", "Content-Type", "Authorization"},
7 months ago
AllowCredentials: false,
7 months ago
MaxAge: 12 * time.Hour,
7 months ago
})
}