Enhance CORS Configuration in HTTP Server Initialization
- Updated the CORS middleware configuration in the HTTP server initialization to include additional allowed headers: Origin, Content-Type, Accept, and Authorization. - This enhancement improves the flexibility and security of cross-origin requests, ensuring that necessary headers are accepted for proper API functionality.
This commit is contained in:
@@ -89,6 +89,12 @@ func InitHTTPServer(conf Config, log logger.Logger) *echo.Echo {
|
||||
e.Use(middleware.CORSWithConfig(middleware.CORSConfig{
|
||||
AllowOrigins: []string{"*"},
|
||||
AllowMethods: []string{echo.GET, echo.POST, echo.PUT, echo.DELETE, echo.OPTIONS, echo.PATCH},
|
||||
AllowHeaders: []string{
|
||||
echo.HeaderOrigin,
|
||||
echo.HeaderContentType,
|
||||
echo.HeaderAccept,
|
||||
echo.HeaderAuthorization,
|
||||
},
|
||||
}))
|
||||
|
||||
// Add custom middleware for logging
|
||||
|
||||
Reference in New Issue
Block a user