Skip to content

Commit

Permalink
fix: cors
Browse files Browse the repository at this point in the history
  • Loading branch information
RockChinQ committed Apr 12, 2024
1 parent a5a9ae5 commit ab0010f
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions backend/controller/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ func NewApiController(
r.Use(
cors.New(
cors.Config{
AllowOrigins: []string{"*"},
AllowMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"},
AllowHeaders: []string{"Origin", "Content-Length", "Content-Type", "Authorization"},
ExposeHeaders: []string{"Content-Length"},
AllowCredentials: true,
AllowOriginFunc: func(origin string) bool {
return true
AllowOrigins: []string{
"http://localhost:3000",
"http://127.0.0.1:3000",
},
MaxAge: 12 * time.Hour,
AllowMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS", "HEAD"},
AllowHeaders: []string{"Origin", "Content-Length", "Content-Type", "Authorization", "Cookie"},
ExposeHeaders: []string{"Content-Length", "Content-Type"},
AllowCredentials: true,
MaxAge: 12 * time.Hour,
},
),
)
Expand Down

0 comments on commit ab0010f

Please sign in to comment.