diff --git a/Changes.md b/Changes.md index 93a262dc..16df09b4 100644 --- a/Changes.md +++ b/Changes.md @@ -4,6 +4,7 @@ ----------- - Re-enable eager loading of all code when running non-development Rails 5. [#3203] +- Better root URL handling for zany web servers [#3207] 4.2.4 ----------- diff --git a/lib/sidekiq/web/application.rb b/lib/sidekiq/web/application.rb index bfc420bf..a572fabb 100644 --- a/lib/sidekiq/web/application.rb +++ b/lib/sidekiq/web/application.rb @@ -28,10 +28,6 @@ module Sidekiq # nothing, backwards compatibility end - get "" do - redirect(root_path) - end - get "/" do @redis_info = redis_info.select{ |k, v| REDIS_KEYS.include? k } stats_history = Sidekiq::Stats::History.new((params['days'] || 30).to_i) diff --git a/lib/sidekiq/web/router.rb b/lib/sidekiq/web/router.rb index b2072bcd..94a03ad2 100644 --- a/lib/sidekiq/web/router.rb +++ b/lib/sidekiq/web/router.rb @@ -45,6 +45,10 @@ module Sidekiq request_method = env[REQUEST_METHOD] path_info = ::Rack::Utils.unescape env[PATH_INFO] + # There are servers which send an empty string when requesting the root. + # These servers should be ashamed of themselves. + path_info = "/" if path_info == "" + @routes[request_method].each do |route| if params = route.match(request_method, path_info) env[ROUTE_PARAMS] = params