Answer the question
In order to leave comments, you need to log in
Broke cookie in yii2. They don't work in fontende, but they work in backend. What to do?
In general, I did not understand how, but I broke the preservation of cookies. The frontend app stopped working. I haven't figured out what to pay attention to yet. Can anyone give me some advice on how to fix the error.
I noticed this is how Ajax requests didn't work for me. Started digging. Yii2 saves csrf in cookies, which it then compares when requested. it is not saved there and it starts generating a new one. at this moment csrf does not converge and ajax falls down
Put the code in order to see if the save works. But saving didn't work. Everything is fine in the backend
$cookies = Yii::$app->response->cookies;
$cookies->add(new Cookie([
'name' => 'test',
'value' => 'test',
]));
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question