Skip to content

Commit

Permalink
Fix Proxy web server middleware order (#51386) (#51424)
Browse files Browse the repository at this point in the history
The limiter middleware was being executed prior to the middleware
responsible updating the client IP from X-Forwarded-For headers.
This results in erroneously enforcing connection limits in NAT
environments.
  • Loading branch information
rosstimothy authored Jan 23, 2025
1 parent 6194bc8 commit d1fb91a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -4609,9 +4609,9 @@ func (process *TeleportProcess) initProxyEndpoint(conn *Connector) error {
Server: &http.Server{
Handler: utils.ChainHTTPMiddlewares(
webHandler,
makeXForwardedForMiddleware(cfg),
limiter.MakeMiddleware(proxyLimiter),
httplib.MakeTracingMiddleware(teleport.ComponentProxy),
makeXForwardedForMiddleware(cfg),
),
// Note: read/write timeouts *should not* be set here because it
// will break some application access use-cases.
Expand Down

0 comments on commit d1fb91a

Please sign in to comment.