I wrote a block in Drupal 8 to render a menu based on the http headers of the request, which contains the users' information from the idp. This menu is supposed to be different from user to user, but currently it is cached once it is generated when the very first user login to the website.
I have tried setting the cache max-age to 0, but it didn't seem to work at all. Then I tried the session of the cache contexts, but still those pages visited by previous users are cached. Neither did header:custid.
Here is a sample code
class MyBlock extends BlockBase{
public function build () {
return array(
'#cache'=>array('contexts'=>array('session')),
'#markup' => ...,
);
}
...
}
Thanks in advance for any help!