add middleware for CORS and mode configuration
This commit is contained in:
18
middleware/cors.go
Normal file
18
middleware/cors.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"github.com/gin-contrib/cors"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func Cors() gin.HandlerFunc {
|
||||
return cors.New(cors.Config{
|
||||
AllowAllOrigins: true,
|
||||
AllowHeaders: []string{
|
||||
"Origin", "Content-Length", "Content-Type", "Workspace", "Request-Id", "Authorization", "Token",
|
||||
},
|
||||
AllowMethods: []string{
|
||||
"GET", "POST", "PUT", "DELETE", "HEAD", "OPTIONS",
|
||||
},
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user