Skip to content

Commit

Permalink
Add CORS headers to server configuration
Browse files Browse the repository at this point in the history
Extended the CORS configuration to include allowed headers. This change ensures that "Origin", "Content-Type", and "Authorization" headers are explicitly permitted in cross-origin requests. This will enhance compatibility with client-side applications requiring these headers.
  • Loading branch information
mukulmantosh committed Aug 25, 2024
1 parent c50dbfc commit 4d99f39
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/handler/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ func NewServer(db database.Database) *Server {

// CORS configuration
corsConfig := cors.Config{
AllowOrigins: []string{"*"}, // List of allowed origins
AllowMethods: []string{"GET", "POST", "PUT", "DELETE"}, // List of allowed methods

AllowOrigins: []string{"*"}, // List of allowed origins
AllowMethods: []string{"GET", "POST", "PUT", "DELETE"}, // List of allowed methods
AllowHeaders: []string{"Origin", "Content-Type", "Authorization"}, // Allow the necessary headers
AllowCredentials: true,
}

Expand Down

0 comments on commit 4d99f39

Please sign in to comment.