From d522c33ba3aa2bfc3e902296b376e45129865988 Mon Sep 17 00:00:00 2001 From: evanpelle Date: Fri, 12 Sep 2025 09:00:49 -0700 Subject: [PATCH] cache /commit.txt for only 5 seconds to prevent stale git commits --- nginx.conf | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/nginx.conf b/nginx.conf index 25c09b3d3..4732c9f80 100644 --- a/nginx.conf +++ b/nginx.conf @@ -132,6 +132,25 @@ server { proxy_set_header X-Forwarded-Proto $scheme; } + # /commit.txt endpoint - Cache for 5 seconds + location = /commit.txt { + proxy_pass http://127.0.0.1:3000; + proxy_http_version 1.1; + + # Cache configuration + proxy_cache API_CACHE; + proxy_cache_valid 200 5s; # Cache successful responses for 5 seconds + proxy_cache_use_stale error timeout http_500 http_502 http_503 http_504; + proxy_cache_lock on; + add_header X-Cache-Status $upstream_cache_status; + + # Standard proxy headers + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } + # Binary files caching location ~* \.(bin|dat|exe|dll|so|dylib)$ { proxy_pass http://127.0.0.1:3000;