Kirby 4 users and fastcgi cache

Guys,

Any idea what would be the the best way to exclude Kirby users from fastcgi cache. We cache all pages all the times, the idea is to exclude logged in users. I could try the below in nginx conf, but i think Kirby session cookie also exists for guests?
if ($http_cookie ~* "kirby_session") { set $skip_cache 1; }

Anything i could do from Kirby to let the sever know if user is logged in or not?

I wonder if it might be possible to add/delete a custom cookie using the user.(login|logout|update) hooks, to reflect the signed-in status.

If that’s not doable, and I still wanted to use the server’s caching mechanism instead of Kirby’s caching, I guess I would try something like:

  1. Set up a different domain or subdomain to access the website.
  2. Configure the server to never cache requests for that secondary domain.
  3. And configure Kirby to always require visitors to sign in when visiting the site through that secondary domain.

You could even configure Kirby to disable the Panel on the primary domain.

See: Configuration — Multi-environment setup.

(I might be missing something easier.)