improve ghttp.CORSDefault

This commit is contained in:
John
2019-06-24 19:05:07 +08:00
parent ebed433dde
commit 05c7ba5f29
5 changed files with 63 additions and 4 deletions

View File

@ -8,7 +8,6 @@
package ghttp
import (
"github.com/gogf/gf/g/text/gstr"
"github.com/gogf/gf/g/util/gconv"
)
@ -26,7 +25,7 @@ type CORSOptions struct {
// 默认的CORS配置
func (r *Response) DefaultCORSOptions() CORSOptions {
return CORSOptions{
AllowOrigin: gstr.TrimRight(r.request.Referer(), "/"),
AllowOrigin: "*",
AllowMethods: HTTP_METHODS,
AllowCredentials: "true",
MaxAge: 3628800,