From ad5a1e6c64b368780c31e2e36cededd9561e41b1 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Sun, 30 Nov 2025 02:07:20 -0500 Subject: [PATCH] Add /health endpoint directly in nginx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fly.io's Consul health checks hit /health. Now nginx responds directly with 200 OK without proxying to uvicorn, so health checks won't fail under heavy load. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- nginx-prod.conf | 7 +++++++ nginx.conf | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/nginx-prod.conf b/nginx-prod.conf index f4150c7..897b806 100644 --- a/nginx-prod.conf +++ b/nginx-prod.conf @@ -93,5 +93,12 @@ http { proxy_set_header Host $host; proxy_buffering off; } + + # Fly.io health check - respond directly from nginx (no upstream needed) + location = /health { + access_log off; + add_header Content-Type application/json; + return 200 '{"status":"ok"}'; + } } } diff --git a/nginx.conf b/nginx.conf index 6c7f5a3..d03d778 100644 --- a/nginx.conf +++ b/nginx.conf @@ -92,5 +92,12 @@ http { proxy_set_header Host $host; proxy_buffering off; } + + # Health check - respond directly from nginx (no upstream needed) + location = /health { + access_log off; + add_header Content-Type application/json; + return 200 '{"status":"ok"}'; + } } }