mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
Ensure Rack::ContentLength is loaded as middleware (#4541)
6.0.5 removed Sidekiq::WebApplication's own Content-Length header calculation, expecting Rack to do it instead via some middleware. This was to fix an issue where New Relic would inject content into Sidekiq's Web UI after the hand crafted content length was calculated. While such middleware exists, it's not enabled by default (at least in a Rails app) and so the HTTP response doesn't have the header at all. The absence of the header has caused unexpected behaviour in an nginx and HAProxy setup, causing each page load to take exactly 20 seconds. The suspicion is that, without the Content-Length response header, HAProxy waits a preset amount of time before deciding the body must have surely been finished and then reponds.
This commit is contained in:
parent
157e06ccd3
commit
8960ecbe64
2 changed files with 9 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -12,6 +12,7 @@ require "sidekiq/web/action"
|
|||
require "sidekiq/web/application"
|
||||
|
||||
require "rack/protection"
|
||||
require "rack/content_length"
|
||||
|
||||
require "rack/builder"
|
||||
require "rack/file"
|
||||
|
@ -172,6 +173,13 @@ module Sidekiq
|
|||
|
||||
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
|
||||
|
|
Loading…
Add table
Reference in a new issue