A platform for community discussion. Free, open, simple.
DEV: add the notion of a 'crawler identifier' in anonymous_cache
Michael Brownc546111703a7
diff --git a/lib/middleware/anonymous_cache.rb b/lib/middleware/anonymous_cache.rbindex 1b472aef734..dae43888370 100644--- a/lib/middleware/anonymous_cache.rb+++ b/lib/middleware/anonymous_cache.rb@@ -78,13 +78,17 @@ module Middleware@request = request || Rack::Request.new(@env)end+ def crawler_identifier+ @user_agent+ end+def blocked_crawler?@request.get? && [email protected]? && [email protected]_with?("robots.txt") &&[email protected]_with?("srv/status") &&@request[Auth::DefaultCurrentUserProvider::API_KEY].nil? &&@env[Auth::DefaultCurrentUserProvider::USER_API_KEY].nil? &&@env[Auth::DefaultCurrentUserProvider::HEADER_API_KEY].nil? &&- CrawlerDetection.is_blocked_crawler?(@user_agent)+ CrawlerDetection.is_blocked_crawler?(crawler_identifier)end# rubocop:disable Lint/BooleanSymbol