go gin 跨域问题解决
目录
介绍
go gin的跨域配置目前不支持*号
代码
下载官网的c
func Cors() gin.HandlerFunc {
handlerFunc := cors.New(cors.Config{
AllowMethods: []string{"*"},
AllowHeaders: []string{"Authentication"}, //此处设置非默认之外的请求头(自定义请求头),否则会出现跨域问题
AllowAllOrigins: true,
AllowC
原创
2021-03-12 17:14:59 ·
591 阅读 ·
0 评论