Support the ongoing development of Laravel.io →
Configuration Requests Session

I'm getting exceptions when I'm trying to resolve malformed session_cookies for laravel.. Is there a good way to reset the session cookie on error handling and redirect to the homepage to generate a new one?

My current code set:

App::error(function(InvalidArgumentException $exception)
{
    if(condition) {
        Log::error('Cookie: Invalid Exception Cookie. Clear Session Cookies and redirect');
        return Redirect::to('/')
            ->withCookie(Cookie::forget(Config::get('session.cookie'));
    }
}
Last updated 2 years ago.
0

Hello,

I am facing a similar issue recently and I need to wipe my session cookies and all the other cookies I might have set within my application. Could you find a proper way to do it within Laravel (5.1)?

Thanks, Federico

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.