http - 关于 Set-Cookie 的 domain 的问题
本文介绍了http - 关于 Set-Cookie 的 domain 的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问 题
一般让 cookie 在所有子域都有效的话会写成这样
Domain=.segmentfault.com
我想问第一个点是必需的吗,写成下面这样有没有问题
Domain=segmentfault.com
解决方案
不是必须的。前置 "." 是旧规范 RFC 2109 (已作废)的要求。
An explicitly specified domain must always start with a dot.
而当前规范 RFC 6265 说了 Set-Cookie 时,domain 属性的前置 "." 会被忽略
Note that a leading %x2E ("."), if present, is ignored even though that character is not permitted
因此第二种写法是没有问题的
这篇关于http - 关于 Set-Cookie 的 domain 的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文