Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Seeker1337's avatar

Laravel 6+ change default cookies' behavior

Hey there. I started learning Laravel a few weeks ago and I'm currently building a website. What I've noticed about the Cookies is that when you visit any page of the website they get set up automatically. I'm talking about:

XSRF-TOKEN ;
[Website Name]_session

After browsing around the files I kind of got lost.

So, how can I make that these cookies get set upon Cookie Notice acceptance like in any website? And if the user rejects to accept them he would get redirected out of the website without any cookies being set. Thank you for your time.

EDIT: I know these cookies are very important so I would make it that any user has to either Accept or Reject them before continuing to browse the website.

0 likes
2 replies
Snapey's avatar

The cookies are only necessary for tracking session and authorising forms. You may not need either?

Please or to participate in this conversation.