i've got a golang REST API, which implements gin-contrib/cors
. But when i call a POST request the preflight request (OPTIONS) returns a 404 result.
Here's a snippet of the implementation:
engine := gin.New()
group := engine.Group("/api/v1")
// Recovery middleware recovers from any panics and writes a 500 if there was one.
group.Use(gin.Recovery())
// Set cors and db middleware
engine.Use(cors.New(cors.Config{
AllowOrigins: []string{"*"},
AllowMethods: []string{"*"},
AllowHeaders: []string{"*"},
AllowCredentials: true,
MaxAge: 12 * time.Hour,
}))
// Register routes
group.POST("/customers", ctrl.SendRequest)