Skip to content

Commit

Permalink
fix(CORS): adding CorsHandler can not work now after merge main, so t…
Browse files Browse the repository at this point in the history
…he workaround it is, do not merge
  • Loading branch information
snowyu committed Jul 20, 2021
1 parent 1ed99e8 commit 566b248
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions routers/web/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,24 @@ func Routes() *web.Route {
routes.Get("/metrics", append(common, Metrics)...)
}

///*
if setting.CORSConfig.Enabled {
corsHandle := cors.Handler(cors.Options{
//Scheme: setting.CORSConfig.Scheme, // FIXME: the cors middleware needs scheme option
AllowedOrigins: setting.CORSConfig.AllowDomain,
//setting.CORSConfig.AllowSubdomain // FIXME: the cors middleware needs allowSubdomain option
AllowedMethods: setting.CORSConfig.Methods,
AllowedHeaders: []string{"*"},
// OptionsPassthrough: true,
Debug: true,
AllowCredentials: setting.CORSConfig.AllowCredentials,
MaxAge: int(setting.CORSConfig.MaxAge.Seconds()),
})
common = append(common, corsHandle)
}
//*/


// Removed: toolbox.Toolboxer middleware will provide debug information which seems unnecessary
common = append(common, context.Contexter())

Expand Down

0 comments on commit 566b248

Please sign in to comment.