As explained on item "Session Cookies" of the Troubleshoot Cache Issues article, you must set the Cache Level to “Site Caching” and add the following code to your .htaccess file:

# BEGIN Prevent Session Cookie Cache
    <ifModule mod_headers.c>
        Header append Vary "Cookie"
# END Prevent Session Cookie Cache

It'll make obligatory the creation of a different cached versions of the pages depending on the value sent by the "Set-Cookie" header.

For NGINX or IIS servers, you should speak with your hosting provider to convert those .htaccess lines to NGINX or IIS rules.