proxy_cache_valid depending on $host

Phil Endecott nginx_list at chezphil.org
Tue Jan 26 17:20:42 UTC 2021


Maxim Dounin wrote:
> On Mon, Jan 25, 2021 at 04:26:49PM +0000, Phil Endecott wrote:
>> Is there some work-around to have different cache validity times
>> for different hosts, in a caching proxy?
>
> Using different server{} blocks with different server_name's is the 
> way to go, see http://nginx.org/r/server_name.

Thanks again, that is the obvious solution and it does seem to work.
I was imagining the the server_name would be matched only against the
Host: header in a regular HTTP request, not the hostname in the request
line in a proxy request - but it seems to do what I want.


Regards, Phil.






More information about the nginx mailing list