Skip to content

Commit

Permalink
Yet another cors fix
Browse files Browse the repository at this point in the history
  • Loading branch information
p0t4t0sandwich committed Apr 10, 2024
1 parent 877869a commit 9913c14
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion api.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,15 @@ func (s *APIServer) Run() error {
cors.Default().Handler,
)

authedMiddlewareStack := middleware.CreateStack(
middleware.AuthMiddleware,
cors.Default().Handler,
)

router := http.NewServeMux()
authedRouter := http.NewServeMux()
router, authedRouter = routerStack(router, authedRouter)
router.Handle("/", cors.Default().Handler(middleware.AuthMiddleware(authedRouter)))
router.Handle("/", authedMiddlewareStack(authedRouter))

v1 := http.NewServeMux()
v1.Handle("/api/v1/", http.StripPrefix("/api/v1", router))
Expand Down

0 comments on commit 9913c14

Please sign in to comment.