[GH-ISSUE #2991] frp + cloudflare 获取真实IP求教 #2388

Closed
opened 2026-05-05 13:32:15 -06:00 by gitea-mirror · 2 comments
Owner

Originally created by @ilworkcn on GitHub (Jun 24, 2022).
Original GitHub issue: https://github.com/fatedier/frp/issues/2991

Bug Description

我目前使用的服务器软件是 nginx
目前的网络是 cloudflare - frp - nginx
目前启用了 proxy_protocolv2
但是现在网站获取到访客IP显示的是cloudflare服务器的IP 各种能想到的方法都试过了(我菜)
求教如何获取访客真实IP

frpc Version

0.43.0

frps Version

0.43.0

System Architecture

linux/amd64

Configurations

屏幕截图 2022-06-24 105330
屏幕截图 2022-06-24 105404

Logs

No response

Steps to reproduce

...

Affected area

  • Docs
  • Installation
  • Performance and Scalability
  • Security
  • User Experience
  • Test and Release
  • Developer Infrastructure
  • Client Plugin
  • Server Plugin
  • Extensions
  • Others
Originally created by @ilworkcn on GitHub (Jun 24, 2022). Original GitHub issue: https://github.com/fatedier/frp/issues/2991 ### Bug Description 我目前使用的服务器软件是 nginx 目前的网络是 cloudflare - frp - nginx 目前启用了 proxy_protocolv2 但是现在网站获取到访客IP显示的是cloudflare服务器的IP 各种能想到的方法都试过了(我菜) 求教如何获取访客真实IP ### frpc Version 0.43.0 ### frps Version 0.43.0 ### System Architecture linux/amd64 ### Configurations ![屏幕截图 2022-06-24 105330](https://user-images.githubusercontent.com/34296329/175452856-13b75d49-de61-4815-abc2-f99f33121771.png) ![屏幕截图 2022-06-24 105404](https://user-images.githubusercontent.com/34296329/175452861-72d50718-1b08-4bbf-b172-562f2dbf425f.png) ### Logs _No response_ ### Steps to reproduce 1. 2. 3. ... ### Affected area - [ ] Docs - [ ] Installation - [ ] Performance and Scalability - [ ] Security - [ ] User Experience - [ ] Test and Release - [ ] Developer Infrastructure - [ ] Client Plugin - [ ] Server Plugin - [ ] Extensions - [X] Others
Author
Owner

@Becods commented on GitHub (Jun 28, 2022):

一般来说CDN厂商都采用了X-Forwarded-For和X-Real_IP等标准协议
所以取这两个标头就行了

<!-- gh-comment-id:1168464517 --> @Becods commented on GitHub (Jun 28, 2022): 一般来说CDN厂商都采用了X-Forwarded-For和X-Real_IP等标准协议 所以取这两个标头就行了
Author
Owner

@ilworkcn commented on GitHub (Jun 28, 2022):

谢谢 我去试试

<!-- gh-comment-id:1168545063 --> @ilworkcn commented on GitHub (Jun 28, 2022): > 谢谢 我去试试
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#2388
No description provided.