When visiting a Drupal8 + CiviCRM 5.4.0 website with Varnish, Varnish caching works fine until you hit the /civicrm/contribute/transact?reset=1&id=x page and leaving this page by clicking an other url (Drupal), a CiviCRM cookie (can't find matching session) doesn't gets unset which breaks Varnish.
I found a similar issue here: https://issues.civicrm.org/jira/browse/CRM-8765