fix order of rate limiter middleware

This commit is contained in:
Matt Drollette
2014-09-13 13:31:03 -05:00
parent 1f7d471fb9
commit c59c1bf00d

View File

@@ -78,13 +78,13 @@ func (rs *Reseeder) Start(addr, port, cert, key string) {
// timeout
muxWithMiddlewares := http.TimeoutHandler(r, time.Second*5, "Timeout!")
th := throttled.RateLimit(throttled.PerMin(rs.RateLimit), &throttled.VaryBy{RemoteAddr: true}, store.NewMemStore(1000))
muxWithMiddlewares = th.Throttle(muxWithMiddlewares)
if rs.Proxy {
muxWithMiddlewares = proxiedHandler(muxWithMiddlewares)
}
th := throttled.RateLimit(throttled.PerMin(rs.RateLimit), &throttled.VaryBy{RemoteAddr: true}, store.NewMemStore(0))
muxWithMiddlewares = th.Throttle(muxWithMiddlewares)
if rs.Verbose {
muxWithMiddlewares = handlers.CombinedLoggingHandler(os.Stdout, muxWithMiddlewares)
}