有2个Http头部和Cookie有关:Set-Cookie和Cookie。
Set-Cookie
由服务器发送,它包含在响应请求的头部中。它用于在客户端创建一个Cookie。
Cookie头
由浏览器发送,包含在HTTP请求的头部中。注意,只有cookie的domain和path与请求的URL匹配才会发送这个cookie。
Cookie 的特点
服务器通过 Set-Cookie 响应头设置 Cookie
浏览器得到 Cookie 之后,每次请求都要带上 Cookie
服务器读取 Cookie 就知道登录用户的信息(email)
默认有效期20分钟左右,不同浏览器策略不同 后端可以设置
Cookie 是不安全的 想改就改啊

)

网友评论