FRiCKLE / ngx_cache_purge

nginx module which adds ability to purge content from FastCGI, proxy, SCGI and uWSGI caches.
http://labs.frickle.com/nginx_ngx_cache_purge/
Other
1.06k stars 311 forks source link

Is it possible to have a wildcard in proxy_cache_key ? #41

Open deweydb opened 8 years ago

deweydb commented 8 years ago

I'm working with the ngx_page_speed module. And i have essnetially 4 caches for every page, because i have added PS-CapabilityList to my proxy_cache_key. Like this:

# Split caches up by custom capabilities
# explaination here: https://github.com/pagespeed/ngx_pagespeed/issues/1059#issuecomment-162385212
set $default_pscap_for_large_screens "LargeScreen.SkipUADependentOptimizations:";
set $default_pscap_for_small_screens "TinyScreen.SkipUADependentOptimizations:";
set $ps_capability_list $default_pscap_for_large_screens;
if ($http_user_agent ~ "(?i)Chrome/|Firefox/|Gecko|MSIE |Trident|Safari|Wget") {
    set $ps_capability_list "ll,ii,dj:";
}
if ($http_user_agent ~ "(?i)Chrome/[2][3-9]+\.|Chrome/[[3-9][0-9]+\.|Chrome/[0-9]{3,}\.") {
    set $ps_capability_list "ll,ii,dj,jw,ws:";
}
if ($http_user_agent ~ "(?i)Firefox/[1-2]\.|MSIE [5-8]\.|bot|Yahoo!|Ruby|RPT-HTTPClient|(Google \(\+https\:\/\/developers\.google\.com\/\+\/we$
    set $ps_capability_list $default_pscap_for_large_screens;
}
if ($http_user_agent ~ "(?i)Mozilla.*Android.*Mobile*|iPhone|BlackBerry|Opera Mobi|Opera Mini|SymbianOS|UP.Browser|J-PHONE|Profile/MIDP|portal$
    set $ps_capability_list $default_pscap_for_small_screens;
}

# Set the proxy cache key
set $cache_key $ps_capability_list$scheme$host$uri$is_args$args;

What i'm wondering is, would it be possible to do a wildcard purge, for example when i want to purge "/" i want to purge it for each of these capabilities as well. so essentially i would need to send 4 requests to purge one page.

would it be possible to do something like: proxy_cache_purge main _wildcard_$scheme$host$1$is_args$args;

Thanks!

andreapernici commented 7 years ago

Yes I'm also interested in this. Is there any way to do that?