Welcome! Log In Create A New Profile

Advanced

Re: proxy_cache_valid depending on $host

Maxim Dounin
January 25, 2021 11:40AM
Hello!

On Mon, Jan 25, 2021 at 04:26:49PM +0000, Phil Endecott wrote:

> Dear Experts,
>
> I wanted to write this:
>
> proxy_cache_valid 200 5m;
> if ($host ~ foo) {
> proxy_cache_valid 200 30d;
> }
>
> but proxy_cache_valid is not allowed in "if" blocks.
> 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.

--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

proxy_cache_valid depending on $host

Phil Endecott January 25, 2021 11:28AM

Re: proxy_cache_valid depending on $host

Maxim Dounin January 25, 2021 11:40AM

Re: proxy_cache_valid depending on $host

Phil Endecott January 26, 2021 12:22PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 180
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready