Skip to content

Commit

Permalink
Adding CORS
Browse files Browse the repository at this point in the history
  • Loading branch information
COMTOP1 committed Jan 6, 2025
1 parent 549b597 commit d0a7b98
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,14 @@ func (r *Router) middleware() {
r.router.Use(middleware.GzipWithConfig(middleware.GzipConfig{
Level: 5,
}))
config := middleware.CORSConfig{
AllowCredentials: true,
Skipper: middleware.DefaultSkipper,
AllowHeaders: []string{echo.HeaderOrigin, echo.HeaderContentType, echo.HeaderAccept,
echo.HeaderAccessControlAllowCredentials, echo.HeaderAccessControlAllowOrigin, echo.HeaderAuthorization},
AllowMethods: []string{http.MethodGet, http.MethodPost},
}
r.router.Use(middleware.CORSWithConfig(config))
}

func (r *Router) loadRoutes() {
Expand Down

0 comments on commit d0a7b98

Please sign in to comment.