mirror of
https://github.com/twofas/2fas-server.git
synced 2024-12-12 12:09:56 +01:00
19 lines
465 B
Go
19 lines
465 B
Go
|
package http
|
||
|
|
||
|
import (
|
||
|
"github.com/gin-contrib/cors"
|
||
|
"github.com/gin-gonic/gin"
|
||
|
"time"
|
||
|
)
|
||
|
|
||
|
func corsMiddleware() gin.HandlerFunc {
|
||
|
return cors.New(cors.Config{
|
||
|
AllowOrigins: []string{"*"},
|
||
|
AllowMethods: []string{"PUT", "PATCH", "POST", "DELETE", "OPTIONS"},
|
||
|
AllowHeaders: []string{"Origin", "Content-Type", "x-requested-with"},
|
||
|
ExposeHeaders: []string{"Content-Length"},
|
||
|
AllowCredentials: true,
|
||
|
MaxAge: 12 * time.Hour,
|
||
|
})
|
||
|
}
|