I am faced with a non-negotiable requirement to set the value of proxy_cache_background_update
dynamically.
The proxy_cache_background_update
directive doesn't support a variable argument. It can only be literal on
or literal off
. So simply setting a variable with Lua and using it in the directive won't work.
proxy_cache_background_update
is also disallowed in if
blocks, so that hope is destroyed too.
(... and no, the directive is not supported by ndk.set_var
either).
Is it somehow possible to define two almost-identical location
or even server
blocks that differ only by the value of proxy_cache_background_update
, and to somehow employ Lua to have either one or the other block "win" depending on the Host
header, completely dynamically without hardcoding any concrete Host
values?
I am also willing to consider other creative solutions that somehow achieve control over the behavior normally governed by the proxy_cache_background_update
directive, either altogether without using the directive, or by somehow causing it to be ignored in favor of the behavior dependent on Host
.