mirror of
https://github.com/acepanel/panel.git
synced 2026-02-04 22:07:16 +08:00
24 lines
644 B
Go
24 lines
644 B
Go
package middleware
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/go-chi/chi/v5/middleware"
|
|
sessionmiddleware "github.com/go-rat/sessions/middleware"
|
|
|
|
"github.com/TheTNB/panel/internal/app"
|
|
)
|
|
|
|
// GlobalMiddleware is a collection of global middleware that will be applied to every request.
|
|
func GlobalMiddleware() []func(http.Handler) http.Handler {
|
|
return []func(http.Handler) http.Handler{
|
|
sessionmiddleware.StartSession(app.Session),
|
|
//middleware.SupressNotFound(app.Http),// bug https://github.com/go-chi/chi/pull/940
|
|
middleware.CleanPath,
|
|
middleware.StripSlashes,
|
|
middleware.Logger,
|
|
middleware.Recoverer,
|
|
middleware.Compress(5),
|
|
}
|
|
}
|