A non-cacheable variable is a value that NGINX recomputes each time it is referenced instead of saving a previously calculated result. This behavior is useful when the value can change during request processing, or when it depends on other inputs that must be evaluated in order. In NGINX configuration, these variables can affect how expressions, maps, and regex captures are expanded.
In security terms, non-cacheable variables matter because evaluation order becomes part of the attack surface. If a configuration mixes regex captures, variable references, and lazy evaluation, a value may be recomputed at a moment the author did not expect. That can lead to logic errors, denial of service, or memory-safety bugs in C-based server code. Defenders should review complex variable chains, test how expressions are expanded, and prefer fixed releases when a bug affects variable handling.


