sub-domain cookies, sent in a parent domain request?

后端 未结 3 1458
耶瑟儿~
耶瑟儿~ 2020-12-30 08:37

Are sub-domain cookies sent in a parent domain HTTP request?

For instance, say I have the cookies:

Name     Value     Domain (not https)
ABC      1           


        
3条回答
  •  一向
    一向 (楼主)
    2020-12-30 08:47

    The cookies of a subdomain only get sent if they were set with a domain with a leading dot on the level above it. So if www.example.com sets a cookie with domain ".example.com" then it gets sent, otherwise not.

    The other way around is more confusing, the cookie set in the top level domain should only get sent to subdomains if it has the leading dot but if you are using internet explorer it will also send it if it got sent without the leading dot (ref).

提交回复
热议问题