Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure Rack::ContentLength is loaded as middleware #4541

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions Changes.md
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions lib/sidekiq/web.rb
Expand Up @@ -12,6 +12,7 @@
require "sidekiq/web/application"

require "rack/protection"
require "rack/content_length"

require "rack/builder"
require "rack/file"
Expand Down Expand Up @@ -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
Expand Down