cloudapi/v2: rearrange middlewares
The duration middleware should come after the tenant channel middleware, otherwise the tenant in the context will be empty. The status middleware can come beforehand because it queries the request context right before sending a response.
This commit is contained in:
parent
fa6f3ba197
commit
f303e7c233
1 changed files with 3 additions and 2 deletions
|
|
@ -93,12 +93,13 @@ func (s *Server) Handler(path string) http.Handler {
|
|||
|
||||
mws := []echo.MiddlewareFunc{
|
||||
prometheus.StatusMiddleware(prometheus.ComposerSubsystem),
|
||||
prometheus.HTTPDurationMiddleware(prometheus.ComposerSubsystem),
|
||||
}
|
||||
if s.config.JWTEnabled {
|
||||
mws = append(mws, auth.TenantChannelMiddleware(s.config.TenantProviderFields, HTTPError(ErrorTenantNotFound)))
|
||||
}
|
||||
mws = append(mws, prometheus.MetricsMiddleware, s.ValidateRequest)
|
||||
mws = append(mws,
|
||||
prometheus.HTTPDurationMiddleware(prometheus.ComposerSubsystem),
|
||||
prometheus.MetricsMiddleware, s.ValidateRequest)
|
||||
RegisterHandlers(e.Group(path, mws...), &handler)
|
||||
|
||||
return e
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue