Open maximejobin opened 1 month ago
hello, with wp rocket pushing "mobile cache" with all the benefits of "Optimize critical images" and "reduce unused css" (which benefits both desktop and mobile total file size) I wonder what the current best caching option is for powerful dedicated hosting?
Have you already decided whether you will improve rocket-nginx (if even possible) to support mobile cache from wp rocket?
I have Cloudflare in front of Nginx which actually sends me CF-Device-Type
header which can have either mobile, tablet (or) desktop as a value. Will this be useful in identifying and serving mobile specific cache by Nginx ?
I see WpRocket already has compatibility with CloudFlare APO which I am currently using and have enabled device specific cache there also (as it is recommended by WPRocket)
Cloudflare uses regex defined here https://developers.cloudflare.com/automatic-platform-optimization/reference/cache-device-type Since WPRocket is compatible with Cloudflare can we use such regex ?
we also use cloudflare (pro) together with wprocket
I have made a direct fix in my config file and it seems to pick proper mobile caches with help of CloudFlare CF-Device-Type
Header (Need to enable Cache By Device Type
in APO)
Leaving it here if someone needs until we have a solution
https://gist.github.com/sriharsha-y/4182b601c2daef407758d90cb3e68fe4
Added below checks & commented out existing mobile cache checks https://gist.github.com/sriharsha-y/4182b601c2daef407758d90cb3e68fe4#file-rocket-nginx-tmpl-L99 https://gist.github.com/sriharsha-y/4182b601c2daef407758d90cb3e68fe4#file-rocket-nginx-tmpl-L166
awesome thank you
Based on Cloudflare documentation, these rules that are incomplete and not perfect could be implemented: https://developers.cloudflare.com/automatic-platform-optimization/reference/cache-device-type/
I do not have enough data to know if it covers 99.9% of all requests or if it 85%.
Implementing Mobile Detection perfectly would be nearly impossible using Nginx's scripting language.
Starting at 3.16, mobile cache is activated by default on new installations following the removal of the Cache tab.
This means two cache files are generated (desktop and mobile) and we need to be able to know if the visitor comes from mobile or not.
This could be tricky as identifying the device is not easy with Ngnix's scripting language.
Could be based on the JSON from Mobile Detect.