Skip to content

Commit

Permalink
Fix: Allow Authorization header on CO Requests.
Browse files Browse the repository at this point in the history
closes #2
  • Loading branch information
JasonLovesDoggo committed Sep 17, 2024
1 parent e7035ab commit 3c0da3e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,15 @@ func main() {
utils.InitializeStats(Client)
// Initialize the Gin router
r := gin.Default()
r.Use(cors.Default())
// Cors
corsConfig := cors.Config{
AllowMethods: []string{"GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"},
AllowHeaders: []string{"Origin", "Content-Length", "Content-Type", "Authorization"},
AllowCredentials: false,
AllowAllOrigins: true,
MaxAge: 12 * time.Hour,
}
r.Use(cors.New(corsConfig))
if os.Getenv("API_ANALYTICS_ENABLED") == "true" {
r.Use(analytics.Analytics(os.Getenv("API_ANALYTICS_KEY"))) // Add middleware
log.Println("Analytics enabled")
Expand Down

0 comments on commit 3c0da3e

Please sign in to comment.