美文网首页
iris 跨域中间键的解决方案

iris 跨域中间键的解决方案

作者: MorningandSun | 来源:发表于2019-08-07 13:28 被阅读0次

app := iris.New()
app.Use(recover.New())
app.Use(logger.New())
crs := cors.New(cors.Options{
AllowedOrigins: []string{""}, //允许通过的主机名称
AllowCredentials: true,
AllowedMethods: []string{"HEAD", "GET", "POST", "PUT", "PATCH", "DELETE"},
AllowedHeaders: []string{"
"},
})
v1 := app.Party("/", crs).AllowMethods(iris.MethodOptions)
{
v1.Get("/AllBlocks", getallblocks)
}
app.Run(iris.Addr(":" + conf.Port))

相关文章

网友评论

      本文标题:iris 跨域中间键的解决方案

      本文链接:https://www.haomeiwen.com/subject/ryjodctx.html