fastcgi_cache_use_stale error timeout updating. When a cached response is served, nginx adds a header X-Cache-Status. What is the value of this header when nginx serves a stale cached response due to an upstream timeout?The X-Cache-Status header shows STALE when nginx serves a stale cached response because the upstream server timed out or returned an error, and the fastcgi_cache_use_stale directive allows serving stale content in such cases.
fastcgi_cache_key directives correctly creates a cache key that includes the host, request URI, and query string to uniquely cache requests?$is_args adds a '?' only if there are query arguments.The correct cache key uses $host$uri$is_args$args. The $uri does not include the query string, so $is_args$args is used to append query parameters only if they exist, ensuring proper formatting without duplication.
If fastcgi_cache_path is missing or incorrect, nginx does not know where to store cached files, so no cache files are created.
First, fastcgi_cache_path defines where cache is stored. Then fastcgi_cache_key defines how to identify cached items. Next, fastcgi_cache_valid sets how long to keep cached items. Finally, fastcgi_cache is enabled in the location block to activate caching.
The fastcgi_cache_purge directive allows defining a location that accepts HTTP PURGE requests to selectively remove cached items safely without downtime or manual file operations.