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

18 lines
406 B

package cors
import (
"github.com/iris-contrib/middleware/cors"
"github.com/kataras/iris/v12/context"
)
func Mycors() context.Handler {
crs := cors.New(cors.Options{
AllowedOrigins: []string{"*"}, //允许通过的主机名称
AllowedMethods: []string{"GET", "POST", "PUT", "DELETE","OPTIONS"},
AllowedHeaders: []string{"*"},
Debug: true,
AllowCredentials: true,
})
return crs
}