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

Higr's avatar
Level 1

Laravel Breeze login doesnt work on production

Installed Laravel Breeze that includes login, registration, password reset etc. In my local dev everything works fine, but on production I cannot get past the login page. After submitting the login form I get redirected back to the login page. Looks like the session is not working properly, but there is a row in the database table sessions for every new user login though. Also tried different session drivers but the issue is still the same. Would appreciate every tip.

1 like
17 replies
jlrdw's avatar

Can you show some code. Many times there is a middleware causing this, so check the logic in any middleware you have.

1 like
Higr's avatar
Level 1

@jlrdw The code is the same as in Laravel Breeze starter kit, I didnt write any custom code Im just using the starter kit for now. I cannot see any Middleware classes in app/Http folder, but I have the RedirectIfAuthenticated.php middleware in vendor folder.

1 like
jlrdw's avatar

@Higr test that your session is persisting.

Put something in session, go to another page and see if you can pull it back out of session.

Also delete packages.php and services.php from bootstrap\cache.

And clear all cache as well.

1 like
Higr's avatar
Level 1

@jlrdw yes the value saved into session is persisting through multiple page refreshes

1 like
vincent15000's avatar

I have noticed that in some situations, the cookies are not pruned from the browser. Then for each new login, the application adds new cookies and you can have such a way 20 or 30 cookies.

I don't have identified what can cause this.

But the solution is to remove manually the cookies from the browser (via the devtools).

Perhaps you are in this situation.

1 like
Higr's avatar
Level 1

@vincent15000 I checked the cookies in browser before, there are always only two. One laravel_session and one CSRF token. Dont think this is my situation. Also tried to change the session settings in .env file in many ways.

1 like
carlosmintfan's avatar

Are you accessing the website using HTTPS? If no, could you try?

1 like
carlosmintfan's avatar

Have you tried accessing the site using multiple browsers / devices?

1 like
Higr's avatar
Level 1

@carlosmintfan yes tried from multiple devices and browsers including mobile phone

1 like
Snapey's avatar

but I have the RedirectIfAuthenticated.php middleware in vendor folder

Why did you choose to mention THAT middleware? Are you aware of what it is used for?

1 like
Higr's avatar
Level 1

So I made it working today. Recreated new laravel project with composer install with breeze on production and the login session is working as it should. Changing DB_CONNECTION to sqlite instead of mysql in .env is what fixed the login bug which creates another problem but can take it from here haha

1 like
Higr's avatar
Level 1

@vincent15000 yes the database tables were set to MyISAM engine and utf8mb3 charset by default, while I needed it to be InnoDB engine and utf8mb4 charset, fixed that and now the login works with mysql database correctly.

Please or to participate in this conversation.