mirror of
https://github.com/fatedier/frp.git
synced 2026-05-15 08:05:49 -06:00
[GH-ISSUE #2839] 请教如何获取客户端真实IP #2269
Labels
No labels
In Progress
WIP
WaitingForInfo
bug
doc
duplicate
easy
enhancement
future
help wanted
invalid
lifecycle/stale
need-issue-template
need-usage-help
no plan
proposal
pull-request
question
todo
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/frp#2269
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @smallfish01 on GitHub (Mar 14, 2022).
Original GitHub issue: https://github.com/fatedier/frp/issues/2839
Bug Description
内网web server用的是nginx,在nginx.conf里添加了X-Forwarded-For和X-Real-IP,
然后在frpc.ini设置了proxy_protocol_version,
当用户在外网访问next.domain.com时,在内部nginx日志上还是显示frps 的IP,不知道配置哪里出错了?
谢谢!
frpc Version
0.38.1
frps Version
0.38.1
System Architecture
Linux/amd64
Configurations
内网Nginx.conf:
server {
listen 80 proxy_protocol;
listen [::]:80;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
server {
listen 443 ssl http2 proxy_protocol;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
frpc.ini
[next]
type = https
local_port = 443
local_ip = 192.168.21.49
custom_domains = next.domain.com
proxy_protocol_version = v2
[next-http]
type = http
local_port = 80
local_ip = 192.168.21.49
custom_domains = next.domain.com
proxy_protocol_version = v2
Logs
No response
Steps to reproduce
...
Affected area
@smallfish01 commented on GitHub (Mar 14, 2022):
经过排查,是Nginx配置不对,正确的应该是:
listen 443 ssl http2 proxy_protocol;
real_ip_header proxy_protocol;
set_real_ip_from 192.168.20.2(frp_server_IP);
但是还有个问题,内网有一台web server用的是IIS,我在frpc.ini里配置了proxy_protocol_version = v2后在外网就无访问该服务器,请问这是什么原因,要如何才能在iis服务器的日志上获取客户端访问的真实IP?
谢谢!
@Becods commented on GitHub (Mar 16, 2022):
配置proxy_protocol之后web服务端只能解析proxy_protocol协议
请另开端口
@smallfish01 commented on GitHub (Mar 21, 2022):
请教下,IIS支持该协议吗,需要怎么配置
@peaceanddemocracy commented on GitHub (May 30, 2022):
是开哪边的端口,nginx还是?可以给个配置文件参考下嘛,小白不懂
@smallfish01 commented on GitHub (Jun 12, 2022):
@peaceanddemocracy commented on GitHub (Jun 13, 2022):
我按照这个设置了,nginx启动报错。。。
@smallfish01 commented on GitHub (Jun 17, 2022):
把你的错误和配置贴出来看看。