mirror of
https://github.com/fatedier/frp.git
synced 2026-05-15 08:05:49 -06:00
[GH-ISSUE #1591] frp 使用 Proxy Protocol 转发 tcp 流到 nginx http 监听端口时 浏览器访问失败 #1259
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#1259
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 @Thonnn on GitHub (Jan 3, 2020).
Original GitHub issue: https://github.com/fatedier/frp/issues/1591
Issue is only used for submiting bug report and documents typo. If there are same issues or answers can be found in documents, we will close it directly.
(为了节约时间,提高处理问题的效率,不按照格式填写的 issue 将会直接关闭。)
(请不要在 issue 评论中出现无意义的 加1,我也是 等内容,将会被直接删除。)
(由于个人精力有限,和系统环境,网络环境等相关的求助问题请转至其他论坛或社交平台。)
Use the commands below to provide key information from your environment:
You do NOT have to include this information if this is a FEATURE REQUEST
What version of frp are you using (./frpc -v or ./frps -v)?
谢谢,以下是我使用的frp版本信息:
frps: 0.22.0
frpc: 0.31.0
What operating system and processor architecture are you using (
go env)?全是 centos7.4。
nginx 正常编译,确认包含 http、stream、http-realip-module、stream-realip-module等等。
经测试 nginx 自身转发自身 proxy_protocol 正常,理论上说,nginx 的 proxy_protocol 加载应该是没有问题的。
Configures you used:
frps.ini:
frpc.ini
Steps to reproduce the issue:
http://101.7074.frp.mydomainDescribe the results you received:

浏览器显示:
有些时候浏览器只给出
ERR_EMPTY_RESPONSE的提示nginx错误日志:
Describe the results you expected:
背景
这么干的原因是,通过tcp流转发实现内网穿透,frp将tcp流转发给nginx http监听端口,继而进行分发。将其部署在一台本地电脑上,通过nginx解析域名格式,实现网段内所有主机http转发。
之所以使用tcp流,是因为实际请求域名由三部分构成:网段ip.端口.frp域名,同时这台服务器的7066、7067等多个端口都在做这个事情,其承担着公司好几个分公司网络穿透的责任。
需求
我程序需要捕获http请求来源的ip地址,参考frp文档,设置
proxy_protocol_version参数,对于所有tcp都可以支持,http自然也是基于tcp的,但是发现不太可行。不知道是哪里的问题。Additional information you deem important (e.g. issue happens only occasionally):
从 nginx 的日志看,请求的头解析出错,意味着可能frp的转发过程中,proxy_protocol 的头设置的有问题。只是不知道问题出在什么地方,frp本身还是我的设置。
同时 nginx 将配置
listen 98 proxy_protocol;改为listen 98;其他配置包括frp配置均不变的情况下,可以正常访问正常使用,只是无法捕获来源ip,程序给的结果是nginx 和 frp 所在的主机内网地址192.168.18.11希望该可以得到解决。
Can you point out what caused this issue (optional)
对frp原理和代码不熟,抱歉。
再次感谢FRP。
@fatedier commented on GitHub (Jan 5, 2020):
frps 也需要升级到最新版本。
@Thonnn commented on GitHub (Jan 5, 2020):
谢谢 已解决,我以为只用改客户端来着,多谢
@keepingcoding commented on GitHub (Nov 24, 2023):
请问怎么解决的