[GH-ISSUE #3456] 获取真实IP问题 proxy_protocol_version = v2 #2766

Closed
opened 2026-05-05 13:46:58 -06:00 by gitea-mirror · 3 comments
Owner

Originally created by @rebootder on GitHub (May 29, 2023).
Original GitHub issue: https://github.com/fatedier/frp/issues/3456

Describe the feature request

客户端配置了
proxy_protocol_version = v2
然后 nginx
real_ip_header proxy_protocol;
set_real_ip_from 127.0.0.1/0;
real_ip_recursive on;
php里面获取的IP地址是 ::ffff:x.x.x.x
怎么是IPV6和IPV4的IP
服务器已经关闭了IPv6
客户端也关闭了IPV6

如何让IP只显示IPV4的
不要IPV6的

Describe alternatives you've considered

No response

Affected area

  • Docs
  • Installation
  • Performance and Scalability
  • Security
  • User Experience
  • Test and Release
  • Developer Infrastructure
  • Client Plugin
  • Server Plugin
  • Extensions
  • Others
Originally created by @rebootder on GitHub (May 29, 2023). Original GitHub issue: https://github.com/fatedier/frp/issues/3456 ### Describe the feature request 客户端配置了 proxy_protocol_version = v2 然后 nginx real_ip_header proxy_protocol; set_real_ip_from 127.0.0.1/0; real_ip_recursive on; php里面获取的IP地址是 ::ffff:x.x.x.x 怎么是IPV6和IPV4的IP 服务器已经关闭了IPv6 客户端也关闭了IPV6 如何让IP只显示IPV4的 不要IPV6的 ### Describe alternatives you've considered _No response_ ### Affected area - [ ] Docs - [X] Installation - [X] Performance and Scalability - [ ] Security - [ ] User Experience - [ ] Test and Release - [ ] Developer Infrastructure - [ ] Client Plugin - [ ] Server Plugin - [ ] Extensions - [ ] Others
gitea-mirror 2026-05-05 13:46:58 -06:00
Author
Owner

@rebootder commented on GitHub (May 29, 2023):

我自己解决了
我原先用的V0.27版本
更换最新版的 V0.49版本问题解决了

问题原因
php 打印 print_r($_SERVER);
[REMOTE_ADDR] => ::ffff:255.255.255.255
返回的IP地址为IPV6
我关闭了服务端和客户端的IPV6 问题依旧
网上找了半天资料都不行

然后想着换个版本试试 结果问题解决了
现在 [REMOTE_ADDR] => 255.255.255.255
能正常显示IPV4

<!-- gh-comment-id:1566997233 --> @rebootder commented on GitHub (May 29, 2023): 我自己解决了 我原先用的V0.27版本 更换最新版的 V0.49版本问题解决了 问题原因 php 打印 print_r($_SERVER); [REMOTE_ADDR] => ::ffff:255.255.255.255 返回的IP地址为IPV6 我关闭了服务端和客户端的IPV6 问题依旧 网上找了半天资料都不行 然后想着换个版本试试 结果问题解决了 现在 [REMOTE_ADDR] => 255.255.255.255 能正常显示IPV4
Author
Owner

@github-actions[bot] commented on GitHub (Jun 29, 2023):

Issues go stale after 30d of inactivity. Stale issues rot after an additional 7d of inactivity and eventually close.

<!-- gh-comment-id:1612274518 --> @github-actions[bot] commented on GitHub (Jun 29, 2023): Issues go stale after 30d of inactivity. Stale issues rot after an additional 7d of inactivity and eventually close.
Author
Owner

@gaojianstyle commented on GitHub (Dec 5, 2023):

我也是这样的问题,nodejs下https获取不到真实ip

<!-- gh-comment-id:1841333532 --> @gaojianstyle commented on GitHub (Dec 5, 2023): 我也是这样的问题,nodejs下https获取不到真实ip
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#2766
No description provided.