incubator-pagespeed-ngx
incubator-pagespeed-ngx copied to clipboard
browser specific nginx downstream proxy_cache documentation with PS-CapabilityList
Quote https://www.modpagespeed.com/doc/downstream-caching#ps-capabilitylist
To use this header properly, however, you have to know which capabilities are supported by which browsers in the version of PageSpeed you're using and craft regular expressions to match exactly those ones. This is very difficult to do in general because it involves duplicating the code in user_agent_matcher.cc as regexes, but a simple division is:
Chrome 32+: ll,ii,dj,jw,wa,ws Firefox 4+, Safari, IE10 (but not IE11): ll,ii,dj Everything else: fully general optimizations only
That sounds rather difficult. I guess one would have to do nginx, if
based on nginx internal user agent variable matching and then conditionally add PS-CapabilityList
to nginx proxy_cache_key
parameter?
Could you please add some recommended examples? It doesn't have to be 100% perfect. Just something useful and doable.
Otherwise - perhaps an easier solution - under the assumption for plenty of free server RAM and disk space - would it be sane, would it work to add the user agent to proxy_cache_key
? I.e. effectively a separate proxy_cache
per user agent? Set proxy_cache_key
as follows...
proxy_cache_key "$http_user_agent$scheme$request_method$host$request_uri$is_args$args";
And then no need to set PS-CapabilityList
?
Hi @adrelanos I think these statements are very old. For example Firefox support webp images from the version 65, now is at 81, IE don´t exists more, they have changed to Edge, based on Chromium aka like Chrome, Safari start to support webp now.... And you can check the shared market cuote for the different browser and see that old browsers are less than 1%. I think that use of UA as a cache key don´t make sense.