Ignore route in the cache

I have implemented forms within Uniform and Ajax on my page like this: https://kirby-uniform.readthedocs.io/en/latest/examples/ajax/

When I cache all pages a get this error: {"csrf_token":["Your session timed out. Please submit the form again."]}.

I find solution on Uniform docs: https://kirby-uniform.readthedocs.io/en/latest/answers/#how-can-i-have-one-or-more-forms-on-cached-pages-that-are-submitted-via-ajax, but I don’t know how to ignore the gettoken route in the cache.

Can you help me please?


the core „pages cache“ has an ignore callback. return false for your template/slug there.

Thanks, I knew about ignore callback, but I didn’t know if I could use it for routes.
So like this?

'cache' => [
    'pages' => [
        'active' => true,
        'ignore' => function ($page) {
            return $page->slug() === 'gettoken';

i would say yes, but i am not sure there is a cache for routes at all. :man_shrugging:

I don’t know if the problem is with ignore route, but my form still don’t working :frowning: