# CSRF token error when trying to save edited landing page layout

**URL:** <https://forum.mautic.org/t/csrf-token-error-when-trying-to-save-edited-landing-page-layout/29799>\
**Category:** Product Support\
**Tags:** mautic-4\
**Created:** [November 1, 2023, 3:40pm UTC](https://forum.mautic.org/t/csrf-token-error-when-trying-to-save-edited-landing-page-layout/29799 "2023-11-01T15:40:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mikehersee](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mikehersee/32/8291_2.png) [@mikehersee](https://forum.mautic.org/u/mikehersee)\
**Post date:** [November 1, 2023, 3:40pm UTC](https://forum.mautic.org/t/csrf-token-error-when-trying-to-save-edited-landing-page-layout/29799/1 "2023-11-01T15:40:31Z")

</div>

**Your software**  
My Mautic version is: 4.4.10  
My PHP version is: 8.0.30  
My Database type and version is: 10.6.15-MariaDB

**Your problem**  
I’ve discovered that this CSRF token error appears to be related to how long you go between saves of your work when editing a landing page. I don’t know what the interval is, so I’m saving it after every few small changes. But if I leave it mid-edit to go and do some food, when I come back, it allows me to continue editing but then blow up with a CSRF token error when I try to save it. So I think it’s definitely to do with some kind of timeout, but which one? How can I make it so it will last at least an hour between needing to save it, or setting up an autosave? I see I’m not the first and so I probably won’t be the last - Any ideas though?. There didn’t appear to be a log file that I could find related to this  
Thanks in anticipation

---

<div class="post-metadata">

**Author:** ![mneumann](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mneumann/32/2512_2.png) [@mneumann](https://forum.mautic.org/u/mneumann)\
**Post date:** [November 8, 2023, 12:38pm UTC](https://forum.mautic.org/t/csrf-token-error-when-trying-to-save-edited-landing-page-layout/29799/2 "2023-11-08T12:38:56Z")

</div>

This happened to me already when editing emails. When I take too long, I get a CSRF token error when saving. It is indeed a timeout and has to do with the time you remain logged in at the system. There is a checkbox: keep me logged in, but in my experience it did not resolve the CSRF token error.

---

<div class="post-metadata">

**Author:** ![EJL](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/ejl/32/12155_2.png) [@EJL](https://forum.mautic.org/u/EJL)\
**Post date:** [November 8, 2023, 4:16pm UTC](https://forum.mautic.org/t/csrf-token-error-when-trying-to-save-edited-landing-page-layout/29799/3 "2023-11-08T16:16:09Z")

</div>

Try setting session.gc.maxlifetime in your php.ini to something higher than 1440

After this number of seconds, stored data will be seen as ‘garbage’ and  
; cleaned up by the garbage collection process.  
; [PHP: Runtime Configuration - Manual](http://php.net/session.gc-maxlifetime)  
session.gc\_maxlifetime = 1440

And

And session.cookie\_lifetime higher  
Lifetime in seconds of cookie or, if 0, until browser is restarted.  
; [PHP: Runtime Configuration - Manual](http://php.net/session.cookie-lifetime)  
session.cookie\_lifetime = 0

---

<div class="post-metadata">

**Author:** ![mikehersee](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mikehersee/32/8291_2.png) [@mikehersee](https://forum.mautic.org/u/mikehersee)\
**Post date:** [November 10, 2023, 10:48pm UTC](https://forum.mautic.org/t/csrf-token-error-when-trying-to-save-edited-landing-page-layout/29799/4 "2023-11-10T22:48:48Z")

</div>

Thanks so much 🙂

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/1X/43c63600fe51440378769136903f1fa2a9a34102.png) [@system](https://forum.mautic.org/u/system)\
**Post date:** [November 18, 2023, 12:43am UTC](https://forum.mautic.org/t/csrf-token-error-when-trying-to-save-edited-landing-page-layout/29799/5 "2023-11-18T00:43:23Z")

</div>

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.
