Answer the question
In order to leave comments, you need to log in
Why cookies are not set via setcookie in php?
FE - admin.site.ru
BE - site.ru
FE accesses site.ru/v1/auth/login
BE tries to set the cookie via setcookie :
$time = time();
$exp = $time + (60 * 60 * 24 * 30);
setcookie('token', '111111', $exp, '/', '.site.ru');
Answer the question
In order to leave comments, you need to log in
Remove the dot to make it just site.ru
You can set a cookie from a subdomain on a domain, but you cannot set a cookie from a domain on a subdomain - the browser will reject such a cookie.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question