Welcome to mirror list, hosted at ThFree Co, Russian Federation.

sidekiq_web_static.rb « middleware « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7640c02fbb5e8df97a69555bd4586725acfc5539 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# frozen_string_literal: true

# This module removes the X-Sendfile-Type header for /admin/sidekiq
# assets since Workhorse isn't always guaranteed to have the assets
# present on disk, such as when using Cloud Native GitLab
# containers. These assets are also small and served infrequently so it
# should be fine to do this.
module Gitlab
  module Middleware
    class SidekiqWebStatic
      SIDEKIQ_REGEX = %r{\A/admin/sidekiq/}

      def initialize(app)
        @app = app
      end

      def call(env)
        env.delete('HTTP_X_SENDFILE_TYPE') if SIDEKIQ_REGEX.match?(env['PATH_INFO'])

        @app.call(env)
      end
    end
  end
end