From 3813ec5d51de45d3d8ce34c5dfa6562f560a69b5 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Wed, 16 Apr 2025 12:03:14 +0100 Subject: [PATCH 1/3] fix: use built-in rails health check https://edgeapi.rubyonrails.org/classes/Rails/HealthController.html --- app/controllers/health_controller.rb | 7 ------- app/views/health/show.html.erb | 1 - config/routes.rb | 2 +- 3 files changed, 1 insertion(+), 9 deletions(-) delete mode 100644 app/controllers/health_controller.rb delete mode 100644 app/views/health/show.html.erb diff --git a/app/controllers/health_controller.rb b/app/controllers/health_controller.rb deleted file mode 100644 index 1298857fc9..0000000000 --- a/app/controllers/health_controller.rb +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -# Controller to display a page stating that Limber is up, as a health check endpoint -class HealthController < ApplicationController - def show - end -end diff --git a/app/views/health/show.html.erb b/app/views/health/show.html.erb deleted file mode 100644 index 7200f7a7b9..0000000000 --- a/app/views/health/show.html.erb +++ /dev/null @@ -1 +0,0 @@ -Limber is up! diff --git a/config/routes.rb b/config/routes.rb index 68bbe622ea..9d1f74852c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -3,7 +3,7 @@ Rails.application.routes.draw do resources 'pipeline_work_in_progress', only: :show - get '/health', controller: :health, action: 'show', as: :health + get '/health' => 'rails/health#show', :as => :rails_health_check scope 'search', controller: :search do get '/', action: :new, as: :search From 834be959e15c6f38df8b138def046e1cca0fbb7e Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Wed, 16 Apr 2025 12:05:04 +0100 Subject: [PATCH 2/3] fix: disable ssl-redirection for health endpoint --- config/environments/production.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/environments/production.rb b/config/environments/production.rb index fc93f9ece8..05a86b2eed 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -49,7 +49,7 @@ config.log_level = :debug # Skip http-to-https redirect for the default health check endpoint. - # config.ssl_options = { redirect: { exclude: ->(request) { request.path == "/up" } } } + config.ssl_options = { redirect: { exclude: ->(request) { request.path == '/health' } } } # Prepend all log lines with the following tags. config.log_tags = [:request_id] From c237baf002cd22f990d17c27e0f021f7aefd55ef Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Wed, 16 Apr 2025 12:36:43 +0100 Subject: [PATCH 3/3] Revert "fix: disable ssl-redirection for health endpoint" This reverts commit 834be959e15c6f38df8b138def046e1cca0fbb7e. --- config/environments/production.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/environments/production.rb b/config/environments/production.rb index 05a86b2eed..fc93f9ece8 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -49,7 +49,7 @@ config.log_level = :debug # Skip http-to-https redirect for the default health check endpoint. - config.ssl_options = { redirect: { exclude: ->(request) { request.path == '/health' } } } + # config.ssl_options = { redirect: { exclude: ->(request) { request.path == "/up" } } } # Prepend all log lines with the following tags. config.log_tags = [:request_id]