[GH-ISSUE #2766] 啟用 https 後, X-Forward-For 和 Proxy Protocol 都無法抓取到正確的真實ip ,但採 http 就能抓到正確的用戶 ip #2213

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

Originally created by @markku636 on GitHub (Jan 18, 2022).
Original GitHub issue: https://github.com/fatedier/frp/issues/2766

Bug Description

啟用 https 後, X-Forward-For 和 Proxy Protocol 都無法抓取到正確的真實ip ,但採 http 就能抓到正確的用戶 ip

  • X-Forwarded-For 只有 frps 的ip,抓不到用戶的 ip
  • 抓不到 X-Real-IP

開發環境
frps 0.38 => 架設在 google cloud ubuntu 上
frpc 0.38 windows (win 10)

frpc Version

0.38 =

frps Version

0.38 =

System Architecture

windows/amd64

Configurations

[Comma.Admin]
type = https
local_port = 5201
custom_domains = works-admin.markkulab.net
plugin = https2http
plugin_local_addr = 127.0.0.1:5201
proxy_protocol_version = v2

HTTPS 证书相关的配置

plugin_crt_path = ./markkulab.net/fullchain.pem
plugin_key_path = ./markkulab.net/privkey.pem
plugin_header_X-From-Where = frp

Originally created by @markku636 on GitHub (Jan 18, 2022). Original GitHub issue: https://github.com/fatedier/frp/issues/2766 ### Bug Description 啟用 https 後, X-Forward-For 和 Proxy Protocol 都無法抓取到正確的真實ip ,但採 http 就能抓到正確的用戶 ip * X-Forwarded-For 只有 frps 的ip,抓不到用戶的 ip * 抓不到 X-Real-IP 開發環境 frps 0.38 => 架設在 google cloud ubuntu 上 frpc 0.38 windows (win 10) ### frpc Version 0.38 = ### frps Version 0.38 = ### System Architecture windows/amd64 ### Configurations [Comma.Admin] type = https local_port = 5201 custom_domains = works-admin.markkulab.net plugin = https2http plugin_local_addr = 127.0.0.1:5201 proxy_protocol_version = v2 # HTTPS 证书相关的配置 plugin_crt_path = ./markkulab.net/fullchain.pem plugin_key_path = ./markkulab.net/privkey.pem plugin_header_X-From-Where = frp
gitea-mirror 2026-05-05 13:25:30 -06:00
Author
Owner

@Becods commented on GitHub (Jan 21, 2022):

请把https放在后端

并且需要启用Proxy Protocol解析 listen 443 ssl proxy_protocol;

<!-- gh-comment-id:1018159914 --> @Becods commented on GitHub (Jan 21, 2022): 请把https放在后端 并且需要启用Proxy Protocol解析 `listen 443 ssl proxy_protocol;`
Author
Owner

@markku636 commented on GitHub (Jan 21, 2022):

謝謝你的建議,
我後來解決了,
我後來發現 net core 的 web server 不支援 Proxy Protocol ,
需要額外透過 nginx 在轉發一層。

<!-- gh-comment-id:1018197821 --> @markku636 commented on GitHub (Jan 21, 2022): 謝謝你的建議, 我後來解決了, 我後來發現 net core 的 web server 不支援 Proxy Protocol , 需要額外透過 nginx 在轉發一層。
Author
Owner

@github-actions[bot] commented on GitHub (Feb 21, 2022):

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

<!-- gh-comment-id:1046361458 --> @github-actions[bot] commented on GitHub (Feb 21, 2022): Issues go stale after 30d of inactivity. Stale issues rot after an additional 7d of inactivity and eventually close.
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#2213
No description provided.