Hello there,
I am using Jetpack mobile theme, so I want different cache for each version, desktop and mobile. Not a problem, just need to first identify if user-agent is mobile, set a variable (mobile=1) and attach this variable to the cache_key.
fastcgi_cache_key $scheme$request_method$host$request_uri$mobile_request";
We then use the server block to identify mobile visitors.
set $mobile_request 0;
if ($http_user_agent ~* "(android|iphone)") {
set $mobile_request 1;
}
Thats not all user agents! This is just a sample
Everything works fine I have two cache versions one for mobile theme and another for desktop, all on same domain. Problem is with cache purge. If I append the $mobile_request variable to the purge cache key identifier, only the version of my useragent (desktop) gets purged. If I leave it empty I get a 404 - cache not fond / not cached on log.
How can I purge both versions?
Best regards!