mirror of
https://github.com/umputun/reproxy.git
synced 2025-11-23 22:04:57 +02:00
fix order of middlewares to handle limiting by IP after match handler sets ctx
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -7,3 +7,4 @@ docker-compose-private.yml
|
|||||||
.vscode
|
.vscode
|
||||||
.idea
|
.idea
|
||||||
*.gpg
|
*.gpg
|
||||||
|
reproxy-private.yml
|
||||||
|
|||||||
@@ -123,11 +123,11 @@ func (h *Http) Run(ctx context.Context) error {
|
|||||||
handler := R.Wrap(h.proxyHandler(),
|
handler := R.Wrap(h.proxyHandler(),
|
||||||
R.Recoverer(log.Default()), // recover on errors
|
R.Recoverer(log.Default()), // recover on errors
|
||||||
signatureHandler(h.Signature, h.Version), // send app signature
|
signatureHandler(h.Signature, h.Version), // send app signature
|
||||||
h.OnlyFrom.Handler, // limit source (remote) IPs if defined
|
|
||||||
h.pingHandler, // respond to /ping
|
h.pingHandler, // respond to /ping
|
||||||
basicAuthHandler(h.BasicAuthEnabled, h.BasicAuthAllowed), // basic auth
|
basicAuthHandler(h.BasicAuthEnabled, h.BasicAuthAllowed), // basic auth
|
||||||
h.healthMiddleware, // respond to /health
|
h.healthMiddleware, // respond to /health
|
||||||
h.matchHandler, // set matched routes to context
|
h.matchHandler, // set matched routes to context
|
||||||
|
h.OnlyFrom.Handler, // limit source (remote) IPs if defined
|
||||||
limiterSystemHandler(h.ThrottleSystem), // limit total requests/sec
|
limiterSystemHandler(h.ThrottleSystem), // limit total requests/sec
|
||||||
limiterUserHandler(h.ThrottleUser), // req/seq per user/route match
|
limiterUserHandler(h.ThrottleUser), // req/seq per user/route match
|
||||||
h.mgmtHandler(), // handles /metrics and /routes for prometheus
|
h.mgmtHandler(), // handles /metrics and /routes for prometheus
|
||||||
|
|||||||
Reference in New Issue
Block a user