[GH-ISSUE #1673] 获取到访客的真实IP全部带有::ffff:前缀 #1325

Closed
opened 2026-05-05 12:50:36 -06:00 by gitea-mirror · 9 comments
Owner

Originally created by @ProjectSky on GitHub (Feb 22, 2020).
Original GitHub issue: https://github.com/fatedier/frp/issues/1673

Issue is only used for submiting bug report and documents typo. If there are same issues or answers can be found in documents, we will close it directly.
(为了节约时间,提高处理问题的效率,不按照格式填写的 issue 将会直接关闭。)
(请不要在 issue 评论中出现无意义的 加1我也是 等内容,将会被直接删除。)
(由于个人精力有限,和系统环境,网络环境等相关的求助问题请转至其他论坛或社交平台。)

Use the commands below to provide key information from your environment:
You do NOT have to include this information if this is a FEATURE REQUEST

What version of frp are you using (./frpc -v or ./frps -v)?

  • 0.27.0

What operating system and processor architecture are you using (go env)?

Configures you used:

[https]
type = https
local_port = 443
custom_domains = test.test.com
proxy_protocol_version = v2
  • nginx.conf
real_ip_header proxy_protocol;
real_ip_recursive on;
  • access.log
::ffff:66.249.64.42

使用proxy_protocol功能尝试获取真实IP,设置完成之后,站点访问正常,但是nginx日志中的访问IP全部带有::ffff:前缀,因为需要判断IP,出现::ffff:字段会导致异常,请问这是什么问题?

Originally created by @ProjectSky on GitHub (Feb 22, 2020). Original GitHub issue: https://github.com/fatedier/frp/issues/1673 Issue is only used for submiting bug report and documents typo. If there are same issues or answers can be found in documents, we will close it directly. (为了节约时间,提高处理问题的效率,不按照格式填写的 issue 将会直接关闭。) (请不要在 issue 评论中出现无意义的 **加1**,**我也是** 等内容,将会被直接删除。) (由于个人精力有限,和系统环境,网络环境等相关的求助问题请转至其他论坛或社交平台。) Use the commands below to provide key information from your environment: You do NOT have to include this information if this is a FEATURE REQUEST **What version of frp are you using (./frpc -v or ./frps -v)?** * 0.27.0 **What operating system and processor architecture are you using (`go env`)?** **Configures you used:** ``` ini [https] type = https local_port = 443 custom_domains = test.test.com proxy_protocol_version = v2 ``` * nginx.conf ``` conf real_ip_header proxy_protocol; real_ip_recursive on; ``` * access.log ``` ::ffff:66.249.64.42 ``` 使用proxy_protocol功能尝试获取真实IP,设置完成之后,站点访问正常,但是nginx日志中的访问IP全部带有::ffff:前缀,因为需要判断IP,出现::ffff:字段会导致异常,请问这是什么问题?
Author
Owner

@fatedier commented on GitHub (Feb 22, 2020):

这个是有效的 IPv6 地址格式,可以被正常解析的。

<!-- gh-comment-id:589957407 --> @fatedier commented on GitHub (Feb 22, 2020): 这个是有效的 IPv6 地址格式,可以被正常解析的。
Author
Owner

@ProjectSky commented on GitHub (Feb 22, 2020):

这个是有效的 IPv6 地址格式,可以被正常解析的。

这是IPv4 映射之后的 IPv6地址,我只需要去除::ffff:

<!-- gh-comment-id:589957847 --> @ProjectSky commented on GitHub (Feb 22, 2020): > 这个是有效的 IPv6 地址格式,可以被正常解析的。 这是IPv4 映射之后的 IPv6地址,我只需要去除::ffff:
Author
Owner

@fatedier commented on GitHub (Feb 22, 2020):

可能是你的服务器支持了 IPv6 ,所以解析出来的地址是这个,解析的代码里还是都兼容下比较好,测试 golang 的 IP 解析函数是支持的。

<!-- gh-comment-id:589958052 --> @fatedier commented on GitHub (Feb 22, 2020): 可能是你的服务器支持了 IPv6 ,所以解析出来的地址是这个,解析的代码里还是都兼容下比较好,测试 golang 的 IP 解析函数是支持的。
Author
Owner

@ProjectSky commented on GitHub (Feb 22, 2020):

可能是你的服务器支持了 IPv6 ,所以解析出来的地址是这个,解析的代码里还是都兼容下比较好,测试 golang 的 IP 解析函数是支持的。

测试了一下,换一台服务器不论开启还是关闭IPV6都不会出现::ffff:,但是换回去又出现了,感觉是服务端的问题,因为其中一台主机我无权访问,不能修改任何东西,只能连接,感觉是服务端的frps版本太旧了。
因为我记得之前也遇到过::ffff:,后来突然正常了,可能是某次更新牵扯到了这个问题。

<!-- gh-comment-id:589980382 --> @ProjectSky commented on GitHub (Feb 22, 2020): > 可能是你的服务器支持了 IPv6 ,所以解析出来的地址是这个,解析的代码里还是都兼容下比较好,测试 golang 的 IP 解析函数是支持的。 测试了一下,换一台服务器不论开启还是关闭IPV6都不会出现::ffff:,但是换回去又出现了,感觉是服务端的问题,因为其中一台主机我无权访问,不能修改任何东西,只能连接,感觉是服务端的frps版本太旧了。 因为我记得之前也遇到过::ffff:,后来突然正常了,可能是某次更新牵扯到了这个问题。
Author
Owner

@fatedier commented on GitHub (Feb 23, 2020):

也不一定是和 frps 的版本有关系,可能是和 frps 所在机器的网络配置有关系。

<!-- gh-comment-id:590064892 --> @fatedier commented on GitHub (Feb 23, 2020): 也不一定是和 frps 的版本有关系,可能是和 frps 所在机器的网络配置有关系。
Author
Owner

@ProjectSky commented on GitHub (Feb 23, 2020):

也不一定是和 frps 的版本有关系,可能是和 frps 所在机器的网络配置有关系。

嗯,没找出具体原因,目前暂时连接另一台的服务器。
先关闭issue吧。

<!-- gh-comment-id:590065197 --> @ProjectSky commented on GitHub (Feb 23, 2020): > 也不一定是和 frps 的版本有关系,可能是和 frps 所在机器的网络配置有关系。 嗯,没找出具体原因,目前暂时连接另一台的服务器。 先关闭issue吧。
Author
Owner

@cnyasin commented on GitHub (Mar 14, 2020):

也不一定是和 frps 的版本有关系,可能是和 frps 所在机器的网络配置有关系。

嗯,没找出具体原因,目前暂时连接另一台的服务器。
先关闭issue吧。

能否贴一下较完整NGINX配置?参考一下?

<!-- gh-comment-id:599084224 --> @cnyasin commented on GitHub (Mar 14, 2020): > > 也不一定是和 frps 的版本有关系,可能是和 frps 所在机器的网络配置有关系。 > > 嗯,没找出具体原因,目前暂时连接另一台的服务器。 > 先关闭issue吧。 能否贴一下较完整NGINX配置?参考一下?
Author
Owner

@ProjectSky commented on GitHub (Mar 20, 2020):

也不一定是和 frps 的版本有关系,可能是和 frps 所在机器的网络配置有关系。

嗯,没找出具体原因,目前暂时连接另一台的服务器。
先关闭issue吧。

能否贴一下较完整NGINX配置?参考一下?

配置已经贴在上面了,开启proxy_protocol就行了。

<!-- gh-comment-id:601544104 --> @ProjectSky commented on GitHub (Mar 20, 2020): > > > 也不一定是和 frps 的版本有关系,可能是和 frps 所在机器的网络配置有关系。 > > > > > > 嗯,没找出具体原因,目前暂时连接另一台的服务器。 > > 先关闭issue吧。 > > 能否贴一下较完整NGINX配置?参考一下? 配置已经贴在上面了,开启proxy_protocol就行了。
Author
Owner

@cnyasin commented on GitHub (Mar 20, 2020):

Sky notifications@github.com于2020年3月20日 周五13:30写道:

也不一定是和 frps 的版本有关系,可能是和 frps 所在机器的网络配置有关系。

嗯,没找出具体原因,目前暂时连接另一台的服务器。
先关闭issue吧。

能否贴一下较完整NGINX配置?参考一下?

配置已经贴在上面了,开启proxy_protocol就行了。


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/fatedier/frp/issues/1673#issuecomment-601544104, or
unsubscribe
https://github.com/notifications/unsubscribe-auth/AIHTH2LJJ634DHGVJ4GIEGLRIL5QFANCNFSM4KZQM5HA
.

嗯!已经结合另一篇issue解决了!谢谢!

<!-- gh-comment-id:601547936 --> @cnyasin commented on GitHub (Mar 20, 2020): Sky <notifications@github.com>于2020年3月20日 周五13:30写道: > 也不一定是和 frps 的版本有关系,可能是和 frps 所在机器的网络配置有关系。 > > 嗯,没找出具体原因,目前暂时连接另一台的服务器。 > 先关闭issue吧。 > > 能否贴一下较完整NGINX配置?参考一下? > > 配置已经贴在上面了,开启proxy_protocol就行了。 > > — > You are receiving this because you commented. > Reply to this email directly, view it on GitHub > <https://github.com/fatedier/frp/issues/1673#issuecomment-601544104>, or > unsubscribe > <https://github.com/notifications/unsubscribe-auth/AIHTH2LJJ634DHGVJ4GIEGLRIL5QFANCNFSM4KZQM5HA> > . > 嗯!已经结合另一篇issue解决了!谢谢!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/frp#1325
No description provided.