Well, i wanted to config my advanced application to work in the shared hosting environment, so i followed this tutorial on Yii2 repository on Github.
tutorial-shared-hosting.md
here is my config file(backend) after followed tutorial steps.
'request' => [
'csrfParam' => '_backendCSRF',
'csrfCookie' => [
'httpOnly' => true,
'path' => '/admin',
],
],
'user' => [
'identityClass' => 'common\models\User',
'enableAutoLogin' => true,
'identityCookie' => [
'name' => '_backendIdentity',
'path' => '/admin',
'httpOnly' => true,
],
],
'session' => [
'name' => 'BACKENDSESSID',
'cookieParams' => [
'path' => '/admin',
],
],
i set a virtual domain in my localhost, called shop.local and set the administrator panel to shop.local/admin, and uses the snippet in tutorial to separate cookie, session and csrf values for backend and frontend. everything was working fine, till i copy/pasted my project to a windows 8 server ( my localhost server is Ubuntu )
when i wanted to login, i get a Bad request (#400) error in server ( backend login ).
i tested everything, and finally, i figured it out, if i remove some codes from config file, my probel is solved. here is my config after removing :
'user' => [
'identityClass' => 'common\models\User',
'enableAutoLogin' => true,
],
'session' => [
'name' => 'BACKENDSESSID',
'cookieParams' => [
'path' => '/admin',
],
],
( i removed the request part, and removed identity cookie from user component. )
I want to know why did this happened ?
and ofcourse, is it ok to use this config file ?
(update: i feel like i must tell u this, i didn’t set a virtual domain in server, my address were something like test.com/path/public_html and test.com/path/public_html/admin i don’t know if it relate to something!)