summaryrefslogtreecommitdiff
path: root/lib/gitlab/middleware/read_only/controller.rb
diff options
context:
space:
mode:
authorAsh McKenzie <amckenzie@gitlab.com>2019-01-14 15:09:01 +1100
committerAsh McKenzie <amckenzie@gitlab.com>2019-01-16 19:14:46 +1100
commitc0a5b628c896d59691b3d3a3a050d53d8a49f729 (patch)
treeb8a8f4f05b86f5d8e898bbb5dafacd5bfe43b3d3 /lib/gitlab/middleware/read_only/controller.rb
parenta2b26577220643a865212cb297a2bf12338176ea (diff)
downloadgitlab-ce-c0a5b628c896d59691b3d3a3a050d53d8a49f729.tar.gz
Allow sidekiq admin requests, regardless of root
Diffstat (limited to 'lib/gitlab/middleware/read_only/controller.rb')
-rw-r--r--lib/gitlab/middleware/read_only/controller.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/gitlab/middleware/read_only/controller.rb b/lib/gitlab/middleware/read_only/controller.rb
index f142f9da43d..e97f22d8315 100644
--- a/lib/gitlab/middleware/read_only/controller.rb
+++ b/lib/gitlab/middleware/read_only/controller.rb
@@ -71,9 +71,13 @@ module Gitlab
@route_hash ||= Rails.application.routes.recognize_path(request.url, { method: request.request_method }) rescue {}
end
+ def relative_url
+ File.join('', Gitlab.config.gitlab.relative_url_root).chomp('/')
+ end
+
# Overridden in EE module
def whitelisted_routes
- grack_route || ReadOnly.internal_routes.any? { |path| request.path.include?(path) } || lfs_route || sidekiq_route
+ grack_route || ReadOnly.internal_routes.any? { |path| request.path.include?(path) } || lfs_route || sidekiq_route?
end
def grack_route
@@ -95,8 +99,8 @@ module Gitlab
WHITELISTED_GIT_LFS_ROUTES[route_hash[:controller]]&.include?(route_hash[:action])
end
- def sidekiq_route
- request.path.start_with?('/admin/sidekiq')
+ def sidekiq_route?
+ request.path.start_with?("#{relative_url}/admin/sidekiq")
end
end
end