How do browser cookie domains work?

后端 未结 9 2067
逝去的感伤
逝去的感伤 2020-11-22 05:34

Due to weird domain/subdomain cookie issues that I\'m getting, I\'d like to know how browsers handle cookies. If they do it in different ways, it would also be nice to know

9条回答
  •  醉酒成梦
    2020-11-22 05:47

    I was surprised to read section 3.3.2 about rejecting cookies:

    http://tools.ietf.org/html/rfc2965

    That says that a browser should reject a cookie from x.y.z.com with domain .z.com, because 'x.y' contains a dot. So, unless I am misinterpreting the RFC and/or the questions above, there could be questions added:

    Will a cookie for .example.com be available for www.yyy.example.com? No.

    Will a cookie set by origin server www.yyy.example.com, with domain .example.com, have it's value sent by the user agent to xxx.example.com? No.

提交回复
热议问题