From 615097155bac993f526394c6f1ea3b3e2ec5d305 Mon Sep 17 00:00:00 2001 From: ale <ale@incal.net> Date: Wed, 14 Aug 2024 08:29:23 +0100 Subject: [PATCH] Serve stale responses while updating the HTTP cache Also ensures that we only send one request to upstream when the cache is invalid. --- roles/float-infra-nginx/templates/config/conf.d/proxy.conf | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/roles/float-infra-nginx/templates/config/conf.d/proxy.conf b/roles/float-infra-nginx/templates/config/conf.d/proxy.conf index 7d31efc2..c67e0401 100644 --- a/roles/float-infra-nginx/templates/config/conf.d/proxy.conf +++ b/roles/float-infra-nginx/templates/config/conf.d/proxy.conf @@ -32,3 +32,9 @@ proxy_cache_min_uses 2; # Show our own error pages, not the remote ones. proxy_intercept_errors on; +# Ensure we only send one upstream request, and allow NGINX to serve +# stale data while updating. +proxy_cache_use_stale updating; +proxy_cache_background_update on; +proxy_cache_lock on; + -- GitLab