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:
n.nakhostin
2025-09-22 13:08:01 +03:30
parent fe70c7170b
commit 5bd8c2b53d
+6
View File
@@ -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