dotweb icon indicating copy to clipboard operation
dotweb copied to clipboard

在路由组上注册跨域中间件时,复杂跨域请求会报CORS策略阻止错误。

Open dotqi opened this issue 1 year ago • 0 comments

在路由组上注册跨域中间件时。如 iweb.HttpServer.Group("/api").Use(cors.New("")) 。 当进行简单跨域请求时一切正常。

当进行复杂跨域请求时。用iweb.HttpServer.SetEnabledAutoOPTIONS(true)自动注册OPTIONS请求。会提示已被CORS策略阻止错误。 如果手动注册OPTIONS请求时一切正常。如 apiGroup.OPTIONS(”/app“, dotweb.DefaultAutoOPTIONSHandler)。

dotqi avatar Dec 07 '22 16:12 dotqi