I went through an article about MAGENTO 2 CACHING OVERVIEW
https://alankent.me/2014/12/09/magento-2-caching-overview/
It tells Magento uses ajax and basically rely on JS
for showing private content.
But if we search in magento vendor directory, It uses ESI tags.
protected function _wrapEsi(
\Magento\Framework\View\Element\AbstractBlock $block,
\Magento\Framework\View\Layout $layout
) {
$url = $block->getUrl(
'page_cache/block/esi',
[
'blocks' => json_encode([$block->getNameInLayout()]),
'handles' => json_encode($layout->getUpdate()->getHandles())
]
);
// Varnish does not support ESI over HTTPS must change to HTTP
$url = substr($url, 0, 5) === 'https' ? 'http' . substr($url, 5) : $url;
return sprintf('<esi:include src="%s" />', $url);
}
I am not sure, how magento uses ESI. Hope if anybody could explain.