I´ve built a Wordpress website where i use Cloudflare and WP Rocket. I want to use the Wordpress APO feature that is availbable from Cloudflare but i have an issue with it.
In my Functions-file in my WordPress-theme i got a PHP-function that detects if the user is using a mobile browser or not. I use this function to make it possible to deliver more lightweight content on mobile devices. The problem is that the APO delivers the same cached site for both mobile and desktop devices. This makes it so that my PHP-function doesn’t apply and i get the desktop version on a mobile device as well.
My question is; Is it possible to a have a separate cache for mobile devices? Is there any other way to solve this?