Q:

Different Full Page Cache for mobile and desktop

Note: Don't want to use multiple store views.
I have setup 2 different home pages for my website by detecting mobile agent and desktop agent.
Now the problem is, when page cache (Magento default) is generated from mobile, then it is showing mobile home page on desktop.
Is there anything I can do to make different page cache for mobile and desktop for home page?

A:

Nice question, i think you could use the magento vary cookie, read here the relative paragraph to understand how it works.
Like it says, it is used to allow a cache to distinguish between different types of content (e.g. same category pages with different currency are cached from magento as different page versions), so it could be your scenario if you append to the vary string different value depending on $_SERVER['HTTP_USER_AGENT'] (also only for the homepage).
Instead, if you want to not cache the different content, you could get it with an ajax call (that are not cached by default) or avoid to cache entirely the page with the cacheable="false" in xml layout file.

