Welcome! Log In Create A New Profile

Advanced

Re: conditional cache

September 02, 2010 11:02AM
Maxim,
Thats brilliant, thanks
Would proxy_pass be considered as a rewrite and safe within an IF as i use it a lot to bypass cache?

Also, 418 is great code, had never seen that before. I do have some logic elsewhere in my conf where i have more than two ifs. Does Nginx allow the use of nondefined codes? 419 for instance? so i could have

location / {
error_page 418 = @cache1;
error_page 419 = @cache2;

if (...needtoshowcache1...) {
return 418;
}
if (...needtoshowcache2...) {
return 419;
}


proxy_cache cache3;
...
}


location @cache1 {
proxy_cache cache1;
...
}
location @cache2 {
proxy_cache cache2;
...
}


Ive got as far as testing the error_page 419 =@cache2 ; line and nginx didn't choke on that, but haven't tested the actual return yet

And yes, all of this would be easier of the developers set expires in backend, but until they do, im using nginx to make sure our site flies as fast as it can no matter how slow their code is
Subject Author Posted

conditional cache

paul2791 September 01, 2010 03:00PM

Re: conditional cache

Maxim Dounin September 01, 2010 07:28PM

Re: conditional cache

paul2791 September 02, 2010 11:02AM

Re: conditional cache

paul2791 September 02, 2010 11:15AM

Re: conditional cache

Maxim Dounin September 02, 2010 11:56AM

Re: conditional cache

Luca De Marinis September 03, 2010 06:34AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 139
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready