How to set the domain name and path of the cookie is valid

Domain attribute specifies when the browser sends an HTTP request, which comes with this domain need Cookie. For example, Domain is set to example.com, that abc.example.com also comes with this cookie when initiating the request.

Set-Cookie: foo=bar; Domain=example.com

 

When Path attribute specifies the browser sends an HTTP request, which set the path of the domain name can be included with this Cookie, such as the following may only be included with this Cookie in this directory and its sub-path example.com/user; and example.com / guest is not incidental.

Set-Cookie: foo=bar; Domain=example.com; Path=/user

 

Guess you like

Origin www.cnblogs.com/aisowe/p/11566623.html
Recommended