[GH-ISSUE #3868] 无法传递真实ip #3074

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

Originally created by @Xuanzheng0901 on GitHub (Dec 20, 2023).
Original GitHub issue: https://github.com/fatedier/frp/issues/3868

Bug Description

不通过frp,走ipv6的时候能在浏览器的响应头X-Real-Ip中看到客户端的公网ipv6地址,但是走frp的时候显示的是127.0.0.1。是哪里配置的不对吗?
以及不用https2https2插件的时候访问时会报ssl_protocol_error的错误,,
求指教

frpc Version

0.53.0

frps Version

0.53.0

System Architecture

windows/amd64

Configurations

nginx配置:
#这是http模块里配置的:
real_ip_header proxy_protocol;
	real_ip_recursive on;
	set_real_ip_from 192.168.0.0/16;
	set_real_ip_from 127.0.0.0/8;
server {
        listen 443 ssl proxy_protocol;
        listen [::]:443 ssl proxy_protocol;
	root "D:/Program Files (x86)/wordpress";
        server_name www.abc.top;
        ssl_certificate "D:\\Program Files (x86)\\nginx\\cert\\abc.top.pem";
        ssl_certificate_key "D:\\Program Files (x86)\\nginx\\cert\\abc.top.key"; 
		
        client_max_body_size 20480m;
		
		add_header X-From-Where $http_x_from_where; 
		add_header X-Real-IP $proxy_protocol_addr;
		add_header X-Forwarded-For $proxy_protocol_addr;
		
		proxy_set_header Host $http_host;
		
		access_log logs/access.log compression;
		
		
        rewrite /wp-admin$ $scheme://$host$uri/ permanent;
        location / {
            index index.php;
            try_files $uri $uri/ /index.php?$args;
        }
        location ~ \.php*$  {
           
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include fastcgi_params;
        }
		location ~* \.(js|css|png|jpg|jpeg|gif|ico|webp)$ {
            expires max;
            log_not_found off;
        }

    } 

frpc配置:[[proxies]]
name = "blog"
type = "https"
localPort = 443
customDomains = ["www.abc.top"]
transport.proxyProtocolVersion = "v2"

[proxies.plugin]
type = "https2https"
localaddr = "127.0.0.1:443"
keypath = "D:/Program Files (x86)/nginx/cert/abc.top.key"
crtpath = "D:/Program Files (x86)/nginx/cert/abc.top.pem"
hostheaderrewrite = "www.abc.top"
requestHeaders.set.X-From-Where = "frp"

Logs

No response

Steps to reproduce

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 @Xuanzheng0901 on GitHub (Dec 20, 2023). Original GitHub issue: https://github.com/fatedier/frp/issues/3868 ### Bug Description 不通过frp,走ipv6的时候能在浏览器的响应头X-Real-Ip中看到客户端的公网ipv6地址,但是走frp的时候显示的是127.0.0.1。是哪里配置的不对吗? 以及不用https2https2插件的时候访问时会报ssl_protocol_error的错误,, 求指教 ### frpc Version 0.53.0 ### frps Version 0.53.0 ### System Architecture windows/amd64 ### Configurations ``` nginx配置: #这是http模块里配置的: real_ip_header proxy_protocol; real_ip_recursive on; set_real_ip_from 192.168.0.0/16; set_real_ip_from 127.0.0.0/8; server { listen 443 ssl proxy_protocol; listen [::]:443 ssl proxy_protocol; root "D:/Program Files (x86)/wordpress"; server_name www.abc.top; ssl_certificate "D:\\Program Files (x86)\\nginx\\cert\\abc.top.pem"; ssl_certificate_key "D:\\Program Files (x86)\\nginx\\cert\\abc.top.key"; client_max_body_size 20480m; add_header X-From-Where $http_x_from_where; add_header X-Real-IP $proxy_protocol_addr; add_header X-Forwarded-For $proxy_protocol_addr; proxy_set_header Host $http_host; access_log logs/access.log compression; rewrite /wp-admin$ $scheme://$host$uri/ permanent; location / { index index.php; try_files $uri $uri/ /index.php?$args; } location ~ \.php*$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } location ~* \.(js|css|png|jpg|jpeg|gif|ico|webp)$ { expires max; log_not_found off; } } ``` ``` frpc配置:[[proxies]] name = "blog" type = "https" localPort = 443 customDomains = ["www.abc.top"] transport.proxyProtocolVersion = "v2" [proxies.plugin] type = "https2https" localaddr = "127.0.0.1:443" keypath = "D:/Program Files (x86)/nginx/cert/abc.top.key" crtpath = "D:/Program Files (x86)/nginx/cert/abc.top.pem" hostheaderrewrite = "www.abc.top" requestHeaders.set.X-From-Where = "frp" ``` ### Logs _No response_ ### Steps to reproduce _No response_ ### Affected area - [ ] Docs - [ ] Installation - [X] Performance and Scalability - [ ] Security - [X] User Experience - [X] Test and Release - [ ] Developer Infrastructure - [X] Client Plugin - [ ] Server Plugin - [ ] Extensions - [ ] Others
gitea-mirror 2026-05-05 13:59:31 -06:00
Author
Owner

@xqzr commented on GitHub (Dec 20, 2023):

fastcgi_param  HTTP_X_REAL_IP $proxy_protocol_addr;
fastcgi_param  HTTP_X_FORWARDED_FOR $proxy_protocol_addr;
<!-- gh-comment-id:1864783116 --> @xqzr commented on GitHub (Dec 20, 2023): ```conf fastcgi_param HTTP_X_REAL_IP $proxy_protocol_addr; fastcgi_param HTTP_X_FORWARDED_FOR $proxy_protocol_addr; ```
Author
Owner

@ac-sc commented on GitHub (Dec 23, 2023):

我这边使用https2http获取到的是FRP服务器IP地址而不是客户端真实IP

<!-- gh-comment-id:1868190880 --> @ac-sc commented on GitHub (Dec 23, 2023): 我这边使用https2http获取到的是FRP服务器IP地址而不是客户端真实IP
Author
Owner

@github-actions[bot] commented on GitHub (Jan 23, 2024):

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

<!-- gh-comment-id:1905079960 --> @github-actions[bot] commented on GitHub (Jan 23, 2024): 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#3074
No description provided.