beego解决跨域问题:options请求、axios post请求跨域问题

根据网上的资料配置,还是未能解决跨域的问题,错误如下:

1
has been blocked by CORS policy: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'.

网上的配置如下:

1
2
3
4
5
6
beego.InsertFilter("/*", beego.BeforeRouter, cors.Allow(&cors.Options{
AllowAllOrigins: true,
AllowMethods: []string{"*"},
AllowHeaders: []string{"*"},
AllowCredentials: true,
}))
阅读更多