T
T
Tarasovych2018-05-15 21:55:18
HTTP Cookies
Tarasovych, 2018-05-15 21:55:18

Cookie exchange between subdomains?

Can a api.example.comcookie be sent to dev.example.com? That is, is it possible to exchange cookies between subdomains?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
RidgeA, 2018-05-15
@RidgeA

no
But you can make a cookie in a domain
and the cookie will be visible in both domains

D
Dmitry Entelis, 2018-05-15
@DmitriyEntelis

Cookies can only be set on a domain and its subdomains.
Accordingly, globally there are exactly 2 options to make a cross-domain cookie:
a) on the domain, example.comput a handler that hangs the cookie on the desired domain dev.example.comor .example.com
b) on the domain, dev.example.comput the handler that hangs the cookie on the same domain.
You can do it in php, you can (although not securely) do it through js (for example , liba ) - but in any case, you need access to either the target domain or the top-level domain.

A
Andrey, 2018-05-16
@VELIK505

Can api.example.com send a Cookie to dev.example.com? That is, is it possible to exchange cookies between subdomains?

Why is this impossible? Maybe! Domain 1 example.com !!! So you can link all its subdomains.
If puffed, then in php.ini:
but as noted above, the cookie must be created from example.com. This is problem?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question