Loging on frontend failed with no errors
Question
For a few hours I could not login on frontend. (on local domain https://www.magento2.loc, magento 2.2.5, developer mode). If I enter wrong username or password, yes, I receive error message. With correct credentials it just reloaded the login page, that's all. Googling around did not help. I tried all possible settings with cookies and sessions, cleared generated, cache and sessions directories, disabled all modules in app/code and switched to blank theme. The backend, by the way, worked normally. I could log in and out to the dashboard.
The problem was solved by itself when I restarted the computer (MAC, El Capitan) and crossed my fingers.
The question is what could it be? And how to prevent it in production environment?
Solution
I think issue is regarding session, by default session store in files in Magento, you can try to change it to DB for your local instance and try if your problem resolve or not. You can change session storage location from
app->etc->env.php
Replace this:
'session' => [
'save' => 'files'
]
With :
'session' => [
'save' => 'db'
]
On production I think you have to store session on Redis server https://devdocs.magento.com/guides/v2.0/config-guide/redis/redis-session.html
OTHER TIPS
Try this:
Set a
domaine cookie
in :Admin > System > Configuration > Web > Default Cookie Settings
Use HTTP Only
> YesCookie Lifetime >
3600
Clean the content of
var/session
Clean and flush the cache.