mirror of
https://github.com/fatedier/frp.git
synced 2026-05-15 08:05:49 -06:00
[GH-ISSUE #4217] [http2]代理一个只支持http2的server, frp返回502错误码 #3320
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#3320
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 @shuguang101 on GitHub (May 13, 2024).
Original GitHub issue: https://github.com/fatedier/frp/issues/4217
Bug Description
使用frp代理一个只支持http2的server时, frp总是返回502错误码
HTTP 178 HTTP/1.1 502 Bad Gateway使用curl连接frp vhost端口
强制curl使用http2连接,但最终http协议还是failback到http1.1了(frp not agree on a protocol), 返回502错误码
使用curl直接连接原始端口
强制curl使用http2,能够协商成功,最终使用http2,返回200 服务能正常访问
由于被代理的服务只支持http2, 如果强制使用http1.1访问会失败
frpc Version
0.57.0
frps Version
0.57.0
System Architecture
linux/amd64
Configurations
frpc
frps
Logs
No response
Steps to reproduce
...
Affected area
@xqzr commented on GitHub (May 13, 2024):
看起来是
https2https插件,返回的alpn列表中 不含h2建议在 监听 127.0.0.1:12345 的程序 正确配置证书
@shuguang101 commented on GitHub (May 13, 2024):
证书配置是正确的,因为不通过frp代理直接访问原始端口的情况下能正常访问,并且没有证书错误。
@xqzr commented on GitHub (May 13, 2024):
可以尝试 注释掉
[proxies.plugin]及以下的行并添加
localPort = 12345@xqzr commented on GitHub (May 13, 2024):
那是因为,给
curl传递了-k@shuguang101 commented on GitHub (May 13, 2024):
刚试了一下不带k也没有证书错误
@shuguang101 commented on GitHub (May 13, 2024):
https2https 插件和Port 12345 服务用的都是Let's Encrypt的证书(同一个证书)
@xqzr commented on GitHub (May 13, 2024):
既然是 同一个证书,那么 不需要使用插件
@shuguang101 commented on GitHub (May 14, 2024):
用插件设置了一下http header。现在能确定是什么原因吗?
不知道是否和这个有关:
https://www.cnblogs.com/embedded-linux/p/12585854.html
Golang默认支持HTTP/2协议,只要使用TLS则默认启动HTTP/2特性,但对http Client做一些定制化配置后,会覆盖掉http库的默认行为,导致开启HTTP/1.1。
@shuguang101 commented on GitHub (May 15, 2024):
nginx在配置proxy_pass时可以指定http版本
如果无法准确判断http version,是否可以考虑像nginx一样,在插件配置项里添加一个proxy_http_version用于指定http版本。仅仅是个建议哈,我对nginx和http也不是十分熟悉,只是刚刚看到nginx里有这个配置项。