http - http header 是否在浏览器选项卡之间共享?

标签 http cookies http-headers httpcookie

我知道,对于跨同一浏览器的选项卡或窗口发出的请求,cookie 会从客户端(网络浏览器)发送到服务器( www.example.com )。因此,对于给定域,http cookie 在不同浏览器选项卡中是相同的。

但根据我的经验,http header 的情况并非如此。如果浏览器选项卡访问服务器 ( www.example.com ) 并且服务器发送 header - "mycustomeheader: "i am example.com",则此 header 将不可用于同一位置的其他选项卡浏览器窗口或同一浏览器的其他窗口。

以上理解正确吗?

最佳答案

是的,因为 HTTP header 是针对每个请求的,因为您发送或期望每个请求发送或期望 JSON/XML/HTML,例如内容长度 header 值通常会有所不同,具体取决于请求正文

但是 cookies 是 per domain

Every time your browser makes an http request, it checks the (local) cookie database for any cookies that have a domain matching that of the request; if it finds any, it sends them along to the server

关于http - http header 是否在浏览器选项卡之间共享?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69401725/

相关文章:

java - 在 https 连接 header 中设置用户代理属性

javascript - 可以向网络浏览器发出 HTTP 请求吗?

请求前的 HTTP 响应

asp.net - 如何删除身份验证 Cookie

php - 如何检查客户端是否接受特定的返回类型?

node.js - 基于带有 express 的 "Accept" header 的网页有条件服务?

ios - 如何使用swiftHttp获取网络流并将结果输出到控制台

javascript - 有没有办法用 Javascript 阻止 HTTP 请求?

c# - 我应该给这个 cookie 什么域?

authentication - 为跨源请求设置cookie