优化跨域处理

This commit is contained in:
白茶清欢 2025-02-22 17:05:38 +08:00
parent 12d2735663
commit 2c201ae226

View File

@ -82,6 +82,17 @@ func NewServer(port int, optionList ...SetServerOptionFunc) *server {
// 跨域中间件
globalMiddlewareList = append(globalMiddlewareList, request_cors.New(request_cors.Config{
AllowAllOrigins: true,
AllowOrigins: nil,
AllowOriginFunc: nil,
AllowMethods: []string{"*"},
AllowHeaders: []string{"*"},
AllowCredentials: true,
ExposeHeaders: nil,
MaxAge: 0,
AllowWildcard: true,
AllowBrowserExtensions: true,
AllowWebSockets: true,
AllowFiles: true,
}))
}
if len(option.globalMiddlewareList) > 0 {