diff --git a/internal/idlewatcher/handle_http.go b/internal/idlewatcher/handle_http.go index 6d87f49..a0f65ee 100644 --- a/internal/idlewatcher/handle_http.go +++ b/internal/idlewatcher/handle_http.go @@ -38,6 +38,10 @@ func (w *Watcher) ServeHTTP(rw http.ResponseWriter, r *http.Request) { return default: f := &ForceCacheControl{expires: w.expires().Format(http.TimeFormat), ResponseWriter: rw} + w, ok := watcherMap[w.Key()] // could've been reloaded + if !ok { + return + } w.rp.ServeHTTP(f, r) } } diff --git a/internal/route/route.go b/internal/route/route.go index 4834d21..7adfcbd 100644 --- a/internal/route/route.go +++ b/internal/route/route.go @@ -151,6 +151,10 @@ func (r *Route) Validate() gperr.Error { } } + if r.Container != nil && r.Container.IdlewatcherConfig != nil { + r.Idlewatcher = r.Container.IdlewatcherConfig + } + // return error if route is localhost: switch r.Host { case "localhost", "127.0.0.1":