Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
deweydb opened this issue Dec 7, 2015 · 1 comment
Open

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

deweydb opened this issue Dec 7, 2015 · 1 comment

Comments

@deweydb
Copy link

deweydb commented Dec 7, 2015

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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants