There's the cookies
and cookies:MY_COOKIE_NAME
cache context from core. Now I need to invalidate the Internal Page Cache for anonymous users when the value of a specific cookie changes. How can I implement this?
I tried to add:
$build['#cache']['contexts'][] = 'cookies:MY_COOKIE_NAME'
in hook_entity_build_defaults_alter
, but that doesn't help and the page still returns from the cache.