refactor: Update server configuration to allow specific CORS origins
This commit is contained in:
parent
c13dd9addb
commit
49d877486c
3 changed files with 11 additions and 7 deletions
3
main.go
3
main.go
|
@ -109,7 +109,8 @@ func newServer(lc fx.Lifecycle, cfg *config.Config, db *gorm.DB, notifier *notif
|
|||
WriteTimeout: cfg.Server.WriteTimeout,
|
||||
}
|
||||
config := cors.DefaultConfig()
|
||||
config.AllowAllOrigins = true
|
||||
config.AllowAllOrigins = !cfg.IsDoneTickDotCom
|
||||
config.AllowOrigins = cfg.Server.CorsAllowOrigins
|
||||
config.AllowCredentials = true
|
||||
config.AddAllowHeaders("Authorization", "secretkey")
|
||||
r.Use(cors.New(config))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue