From 33719b588c3576e4ef89260f71d5c2d8b86a7793 Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Thu, 20 Mar 2025 11:36:32 -0400 Subject: [PATCH] Restore the 404 page but allow the kamal health check --- config/initializers/tenanting.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/config/initializers/tenanting.rb b/config/initializers/tenanting.rb index 25833f42e..5ada06981 100644 --- a/config/initializers/tenanting.rb +++ b/config/initializers/tenanting.rb @@ -1,9 +1,11 @@ Rails.application.config.after_initialize do + # in production, we're using a two-level subdomain like "tenant.fizzy.37signals.com", but in + # development and beta it's only a single-level subdomain. Rails.application.config.active_record_tenanted.tenant_resolver = ->(request) do - # in production, we're using a two-level subdomain like "tenant.fizzy.37signals.com", but in - # development and beta it's only a single-level subdomain. + next nil if request.path == "/up" + tld_length = request.domain == "37signals.com" ? 2 : 1 - request.subdomain(tld_length).presence # || "no-such-tenant-exists" # this is a quick fix for now + request.subdomain(tld_length).presence || "return-404" # this is a quick fix for now end end