diff --git a/Changes.md b/Changes.md index 9ebdf5498..530b0a140 100644 --- a/Changes.md +++ b/Changes.md @@ -5,6 +5,7 @@ Unreleased --------- +- Ensure `Rack::ContentLength` is loaded as middleware for correct Web UI responses [#4541] - Avoid exception dumping SSL store in Redis connection logging [#4532] 6.0.7 diff --git a/lib/sidekiq/web.rb b/lib/sidekiq/web.rb index 1fc0c47e3..3422bc510 100644 --- a/lib/sidekiq/web.rb +++ b/lib/sidekiq/web.rb @@ -12,6 +12,7 @@ require "sidekiq/web/application" require "rack/protection" +require "rack/content_length" require "rack/builder" require "rack/file" @@ -172,6 +173,13 @@ def build_sessions middlewares.unshift [[::Rack::Session::Cookie, options], nil] end + + # Since Sidekiq::WebApplication no longer calculates its own + # Content-Length response header, we must ensure that the Rack middleware + # that does this is loaded + unless using? ::Rack::ContentLength + middlewares.unshift [[::Rack::ContentLength], nil] + end end def build