Skip to content

Commit

Permalink
调整中间件顺序
Browse files Browse the repository at this point in the history
  • Loading branch information
xmdhs committed Oct 12, 2023
1 parent 2fb0bb9 commit 5e0e954
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions server/route/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ import (
func NewRoute(handelY *yggdrasil.Yggdrasil, handel *handle.Handel, c config.Config, sl slog.Handler) http.Handler {
r := chi.NewRouter()
r.Use(middleware.RequestID)
if c.RaelIP {
r.Use(middleware.RealIP)
}
if sl.Enabled(context.Background(), slog.LevelDebug) {
r.Use(NewStructuredLogger(sl))
}
r.Use(middleware.Recoverer)
r.Use(cors.AllowAll().Handler)
if c.RaelIP {
r.Use(middleware.RealIP)
}
r.Use(APILocationIndication)

r.Mount("/", static.StaticServer())
Expand Down

0 comments on commit 5e0e954

Please sign in to comment.