优化跨域处理
This commit is contained in:
parent
12d2735663
commit
2c201ae226
@ -81,7 +81,18 @@ func NewServer(port int, optionList ...SetServerOptionFunc) *server {
|
|||||||
if option.enableCors {
|
if option.enableCors {
|
||||||
// 跨域中间件
|
// 跨域中间件
|
||||||
globalMiddlewareList = append(globalMiddlewareList, request_cors.New(request_cors.Config{
|
globalMiddlewareList = append(globalMiddlewareList, request_cors.New(request_cors.Config{
|
||||||
AllowAllOrigins: true,
|
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 {
|
if len(option.globalMiddlewareList) > 0 {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user