From 0643bc8c0c3b3fc6f38f1191b52c1e5df7a5fa3c Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Mon, 13 Mar 2023 22:11:53 +0100 Subject: [PATCH] Redirect health check monitoring to /ping We previously optimized the SQL queries, so that anonymous users without any cookie sent no longer result in a database query. This is generally awesome, but it also allows our health check monitoring to pass even when no database connection can be established. --- app/controllers/application_controller.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 602ea9d3..e25cb2ae 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -7,6 +7,7 @@ class ApplicationController < ActionController::Base MEMBER_ACTIONS = %i[destroy edit show update].freeze RENDER_HOST = CodeOcean::Config.new(:code_ocean).read[:render_host] LEGAL_SETTINGS = CodeOcean::Config.new(:code_ocean).read[:legal] || {} + MONITORING_USER_AGENT = Regexp.compile(/updown\.io/).freeze before_action :deny_access_from_render_host after_action :verify_authorized, except: %i[welcome] @@ -134,6 +135,7 @@ class ApplicationController < ActionController::Base def welcome # Show root page + redirect_to ping_index_path if MONITORING_USER_AGENT.match?(request.user_agent) end def load_embed_options