wails-app-dock/pkg/server/middleware/cors.go
2024-02-17 21:45:43 +08:00

15 lines
391 B
Go

package middleware
import (
"github.com/gin-gonic/gin"
)
func CorsMiddleWare() gin.HandlerFunc {
return func(ctx *gin.Context) {
ctx.Header("Access-Control-Allow-Origin", "*")
ctx.Header("Access-Control-Allow-Methods", "POST, GET, OPTIONS, PUT, DELETE")
ctx.Header("Access-Control-Allow-Headers", "Action, Module, X-PINGOTHER, Content-Type, Content-Disposition")
ctx.Next()
}
}