Yii2-错误的请求(#400)|前端和后端Cookie [英] Yii2 - Bad Request (#400) | Frontend and backend cookies
本文介绍了Yii2-错误的请求(#400)|前端和后端Cookie的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
仅当我在同一浏览器中打开
前端
和后端
时,才会出现该问题。 / code>。
The issue appears only when I open frontend
and backend
in the same browser
.
场景:
与后端交互- >切换标签->与前端交互->
切换标签后->与后端交互->错误的请求(#400)
Interact with Backend -> Switched Tab -> Interact with Frontend -> Switched Tab Back -> Interact with Backend -> Bad Request (#400)
Cookie后端
'identityCookie' => [
'name' => '_backendIdentity',
'path'=>'/admin',
'httpOnly' => true,
],
Cookie Frontend
'identityCookie' => [
'name' => '_frontendIdentity',
'path'=>'/',
'httpOnly' => true,
],
会话后端
'session' => [
'name' => 'session_backend'
],
会话前端
'session' => [
'name' => 'session_frontend'
],
推荐答案
前端
和后端$ c $的
CSRF
问题c>因此,当存储同一应用程序会话
的浏览器具有2个不同的 CSRF
时,其中一个应用程序将得到错误请求(#400)
It is the issue of CSRF
that are different on the both frontend
and backend
so when a browser storing the session
of same application have 2 different CSRF
then one of the application will get Bad Request (#400)
这篇关于Yii2-错误的请求(#400)|前端和后端Cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文