区域标识符应该在 X-Forwarded-For IP 中吗?

发布于 2025-01-14 07:30:06 字数 433 浏览 1 评论 0 原文

当使用 Go 的 http/httputil.ReverseProxy 时,监听带有区域的本地地址,通过它在本地(包括区域)发出请求,我发现区域标识符最终出现在 X-Forwarded- 中。 For 标头由反向代理添加。 (您可以看到它发生在这里SplitHostPort 使区域保持完整。)

区域应该位于 XFF IP 中吗?有道理吗?这是一个错误吗?

我对区域标识符的不太清楚的理解是,它在使用它的特定机器之外没有意义。另一方面,也许如果您试图跟踪请求所采取的路径,则需要使用区域来消除歧义吗?

When messing around with Go's http/httputil.ReverseProxy, listening on a local address with a zone, making a request through it locally, including the zone, I've seen that the zone identifier ends up in the X-Forwarded-For header added by the reverse proxy. (You can see it occur around here. SplitHostPort leaves the zone intact.)

Should the zone be in the XFF IP? Does it make sense? Is it a bug?

My not-very-clear understanding of zone identifiers is that it doesn't make sense outside of the particular machine that's using it. On the other hand, maybe if you're trying to trace the path a request took, the zone is necessary to disambiguate?

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

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

发布评论

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

评论(1

过期情话 2025-01-21 07:30:06

经过一段时间的思考,我最终写了一篇博客文章关于它。以下是该帖子的结论部分:

区域应保留到使用点为止,然后应根据 IP 的具体用途以及区域对该用途的影响来决定保留或剥离它们。

这意味着反向代理应该将区域包含在 X-Forwarded-For 标头中,速率限制器可能应该丢弃它们,并且 prefix-contains-IP 检查应该基于是否存在区域前缀。但这些只是示例——IP 地址有多种用途,特定用途将决定(或至少决定)该区域的命运。

当然,这一切都是值得商榷的。要查看其他一些意见,请查看我在 r/ipv6 subreddit。如果您有不同意见或知道其他人写过有关此内容的文章,请告诉我。

After thinking about this for a while, I ended up writing a blog post about it. Here is the conclusions section of that post:

Zones should be kept until the point of use, and then the decision to keep or strip them should be based on the specific use of the IP and ramifications of zones to that use.

This means that reverse proxies should be including the zone in the X-Forwarded-For header, rate limiters should probably be discarding them, and prefix-contains-IP checks should be based on whether there's a zone in the prefix. But these are only examples -- there are myriad uses of IP addresses, and the particular use will dictate (or at least inform) the fate of the zone.

Of course, this is all debatable. To see some other other opinions, check out the few comments I got when I asked about this in the r/ipv6 subreddit. If you have a differing opinion or know of anyone else having written about this, please let me know.

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