[GH-ISSUE #713] frps拦截frpc端web服务器自定义返回值 #560

Closed
opened 2026-05-05 12:21:58 -06:00 by gitea-mirror · 3 comments
Owner

Originally created by @apple431 on GitHub (Apr 19, 2018).
Original GitHub issue: https://github.com/fatedier/frp/issues/713

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 将会直接关闭。)

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)?
frps_0.16.1 frpc_0.16.1

What operating system and processor architecture are you using (go env)?
frps:搬瓦工VPS Centos 6 x86
frpc:树莓派2B Linux raspberrypi 4.9.59
Configures you used:
树莓派布置web服务器,实现远程访问,并通过页面点击调用cgi程序操作树莓派硬件端口控制外部设备,同时读取外部设备状态返回到浏览器,浏览器根据返回值刷新页面

Steps to reproduce the issue:
1.能够正常访问树莓派网页
2.能够通过点击网页图标控制树莓派硬件接口
3.无法正确收到硬件状态的返回值(花生壳透传时能收到)

Describe the results you received:
frps.log记录的错误信息:(其中 101 是自定义的返回值)
2018/04/18 11:19:26 [W] [newhttp.go:189] http: proxy error: net/http: HTTP/1.x
transport connection broken: malformed HTTP response "101"
浏览器收到的错误信息:
“The page you visit not found.
Sorry, the page you are looking for is currently unavailable.
Please try again later.
The server is powered by frp.
Faithfully yours, frp.”

Describe the results you expected:
希望frps不拦截返回到浏览器的返回值,直接透传

Additional information you deem important (e.g. issue happens only occasionally):

Can you point out what caused this issue (optional)
frps收到用户自定义的返回值,认为不合法,将错误信息返回给浏览器了

Originally created by @apple431 on GitHub (Apr 19, 2018). Original GitHub issue: https://github.com/fatedier/frp/issues/713 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 将会直接关闭。) 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)?** frps_0.16.1 frpc_0.16.1 **What operating system and processor architecture are you using (`go env`)?** frps:搬瓦工VPS Centos 6 x86 frpc:树莓派2B Linux raspberrypi 4.9.59 **Configures you used:** 树莓派布置web服务器,实现远程访问,并通过页面点击调用cgi程序操作树莓派硬件端口控制外部设备,同时读取外部设备状态返回到浏览器,浏览器根据返回值刷新页面 **Steps to reproduce the issue:** 1.能够正常访问树莓派网页 2.能够通过点击网页图标控制树莓派硬件接口 3.无法正确收到硬件状态的返回值(花生壳透传时能收到) **Describe the results you received:** frps.log记录的错误信息:(其中 101 是自定义的返回值) 2018/04/18 11:19:26 [W] [newhttp.go:189] http: proxy error: net/http: HTTP/1.x transport connection broken: malformed HTTP response "101" 浏览器收到的错误信息: “The page you visit not found. Sorry, the page you are looking for is currently unavailable. Please try again later. The server is powered by frp. Faithfully yours, frp.” **Describe the results you expected:** 希望frps不拦截返回到浏览器的返回值,直接透传 **Additional information you deem important (e.g. issue happens only occasionally):** **Can you point out what caused this issue (optional)** frps收到用户自定义的返回值,认为不合法,将错误信息返回给浏览器了
Author
Owner

@fatedier commented on GitHub (Apr 19, 2018):

本地测试 http code 为 101 时是可以正常转发的。
能否确认下你的 cgi 程序返回的 http 响应的具体内容?比如通过抓包的方式来实现。猜测是返回的内容不符合 http 协议造成的,正常的 http 响应第一行应该是 HTTP/1.1 101 Switching Protocols 这样的格式。

如果你不方便调试,也可以直接使用 tcp 类型来做穿透,这样的话 frp 是不解析具体协议内容的。

<!-- gh-comment-id:382775634 --> @fatedier commented on GitHub (Apr 19, 2018): 本地测试 http code 为 101 时是可以正常转发的。 能否确认下你的 cgi 程序返回的 http 响应的具体内容?比如通过抓包的方式来实现。猜测是返回的内容不符合 http 协议造成的,正常的 http 响应第一行应该是 `HTTP/1.1 101 Switching Protocols` 这样的格式。 如果你不方便调试,也可以直接使用 `tcp` 类型来做穿透,这样的话 frp 是不解析具体协议内容的。
Author
Owner

@apple431 commented on GitHub (Apr 20, 2018):

好的,我测试一下,多谢

<!-- gh-comment-id:383039596 --> @apple431 commented on GitHub (Apr 20, 2018): 好的,我测试一下,多谢
Author
Owner

@apple431 commented on GitHub (Apr 25, 2018):

试了几天,终于可以了,是http协议的问题。在用户数据前先发送
HTTP/1.1 200 OK /r/n 等即可

<!-- gh-comment-id:384381294 --> @apple431 commented on GitHub (Apr 25, 2018): 试了几天,终于可以了,是http协议的问题。在用户数据前先发送 HTTP/1.1 200 OK /r/n 等即可
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#560
No description provided.