使用“X-...”是安全的HTTP 响应中的标头?

发布于 2024-08-12 10:54:50 字数 100 浏览 3 评论 0 原文

我必须在 HTTP 响应中传递元信息,因此我发现可以使用响应标头,例如“X-MyData: 123456”。这样安全吗?我的意思是,客户端代理有可能删除此标头吗?

谢谢!

I have to pass a meta-information in my HTTP response so I figured out that I could use the response header, for instance "X-MyData: 123456". Is that safe? I mean, there is a possibility that a client proxy remove this header?

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

不离久伴 2024-08-19 10:54:50

作为参考,X- 标头在 RFC 2045,作为 RFC 2047 以及 新闻文章格式草稿。

反对在应用程序协议中使用“X-”前缀(BCP,2012 年 6 月):

不赞成大多数应用程序协议的“X-”约定,并且
就如何在没有的世界中继续前进提出具体建议
标准参数与非标准参数的区别

For reference, X- headers are also referred to as x-token in the BNF of RFC 2045, as user-defined ("X-") in section 5 of RFC 2047 and as Experimental headers in section 4.2.2.1 of the News Article Format draft.

Deprecating Use of the "X-" Prefix in Application Protocols (BCP, June 2012):

deprecates the "X-" convention for most application protocols and
makes specific recommendations about how to proceed in a world without
the distinction between standard and non-standard parameters

放肆 2024-08-19 10:54:50

客户端代理可以做任何它想做的事情,但通常不会剥离任何标头。

以 X- 开头的标头通常保留用于非标准用途(即,未来的标准不会引入以 X- 开头的标头),但代理可以理解它们并选择根据需要修改它们。

A client proxy could do anything it wanted, but in general would not strip any headers.

Headers starting with an X- are typically reserved for nonstandard usage (i.e. no future standard will introduce a header starting X-) but a proxy may understand them and choose to modify them as it wants.

树深时见影 2024-08-19 10:54:50

代理服务器或链中的任何中间链接可能修改您的标头,但这通常不是问题。

通常,指定自定义标头就可以,只要它们足够独特,不会与其他人的标头发生冲突,并且您不希望其他人使用您的标头。

It is possible for proxy servers or any intermediate links in the chain to modify your headers, but this usually isn't a problem.

More often than not, specifying custom headers is fine as long as they're unique enough not to conflict with other people's headers and you don't expect anyone else to use yours.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文