[GH-ISSUE #2953] [Feature Request] frpc和frps之间的wss支持不完整 #2356

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

Originally created by @woOzZ2 on GitHub (May 27, 2022).
Original GitHub issue: https://github.com/fatedier/frp/issues/2953

Describe the feature request

由于有高层转发的需求,所以在frpc和frps的通信协议的选项我只能选择websocket
在使用webscoket作为frpc和frps之间的通信协议的时候,即便开启了enable_tls = true,frpc发起websocket握手的时候也是http请求,并不是https。如下

image

在关闭了tls也就是没有设置enable_tls = true的时候,可以看到websocket握手后的通信内容

image

即使我在frps.ini设置了only_tls = true,握手过程也没有tls参与

image

在使用tcp作为frpc和frps之间的协议的时候,如下图,是有完整的tls握手的,除了SNI外我们看不到任何的信息

所以我认为
1.frpc和frps之间的websoket协议并不完整支持tls
2.enable_tls = true在websocket协议的情况下工作的不一样

-------配置文件-----

---frps.ini---
[common]
bind_port = 7000
kcp_bind_port = 7000
tls_only = true

---frpc.ini---
[common]
server_addr = 127.0.0.1
server_port = 7000
protocol = websocket
tls_enable = true

[WSS_test]
type = tcp
local_ip = 127.0.0.1
local_port = 2345
remote_port = 7890

Describe alternatives you've considered

Affected area

  • Docs
  • Installation
  • Performance and Scalability
  • Security
  • User Experience
  • Test and Release
  • Developer Infrastructure
  • Client Plugin
  • Server Plugin
  • Extensions
  • Others
Originally created by @woOzZ2 on GitHub (May 27, 2022). Original GitHub issue: https://github.com/fatedier/frp/issues/2953 ### Describe the feature request 由于有高层转发的需求,所以在frpc和frps的通信协议的选项我只能选择websocket 在使用webscoket作为frpc和frps之间的通信协议的时候,即便开启了`enable_tls = true`,frpc发起websocket握手的时候也是http请求,并不是https。如下 <img width="1386" alt="image" src="https://user-images.githubusercontent.com/21095700/170632663-72a44705-fd97-464a-b1c2-462e4c66221a.png"> 在关闭了tls也就是没有设置`enable_tls = true`的时候,可以看到websocket握手后的通信内容 <img width="1398" alt="image" src="https://user-images.githubusercontent.com/21095700/170632834-d797dc61-68a1-4dd0-b45d-1d6f377070d0.png"> 即使我在frps.ini设置了`only_tls = true`,握手过程也没有tls参与 <img width="1398" alt="image" src="https://user-images.githubusercontent.com/21095700/170632973-55ac363d-c16c-416b-a126-9cdbb652cee3.png"> 在使用tcp作为frpc和frps之间的协议的时候,如下图,是有完整的tls握手的,除了SNI外我们看不到任何的信息 所以我认为 `1.frpc和frps之间的websoket协议并不完整支持tls` `2.enable_tls = true在websocket协议的情况下工作的不一样` -------配置文件----- ---frps.ini--- [common] bind_port = 7000 kcp_bind_port = 7000 tls_only = true ---frpc.ini--- [common] server_addr = 127.0.0.1 server_port = 7000 protocol = websocket tls_enable = true [WSS_test] type = tcp local_ip = 127.0.0.1 local_port = 2345 remote_port = 7890 ### Describe alternatives you've considered 无 ### Affected area - [ ] Docs - [ ] Installation - [X] Performance and Scalability - [X] Security - [ ] User Experience - [ ] Test and Release - [ ] Developer Infrastructure - [ ] Client Plugin - [ ] Server Plugin - [ ] Extensions - [ ] Others
gitea-mirror 2026-05-05 13:31:08 -06:00
Author
Owner

@github-actions[bot] commented on GitHub (Jun 27, 2022):

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

<!-- gh-comment-id:1166697368 --> @github-actions[bot] commented on GitHub (Jun 27, 2022): Issues go stale after 30d of inactivity. Stale issues rot after an additional 7d of inactivity and eventually close.
Author
Owner

@aa51513 commented on GitHub (Jul 26, 2022):

为什么不直接用tcp+tls呢

<!-- gh-comment-id:1195009623 --> @aa51513 commented on GitHub (Jul 26, 2022): 为什么不直接用tcp+tls呢
Author
Owner

@woOzZ2 commented on GitHub (Jul 26, 2022):

不直接用tcp+tls呢

tcp + tls 没法过CDN,我们业务需要走CDN

<!-- gh-comment-id:1195381280 --> @woOzZ2 commented on GitHub (Jul 26, 2022): > 不直接用tcp+tls呢 tcp + tls 没法过CDN,我们业务需要走CDN
Author
Owner

@happytrudy commented on GitHub (Jul 9, 2025):

Describe the feature request

由于有高层转发的需求,所以在frpc和frps的通信协议的选项我只能选择websocket 在使用webscoket作为frpc和frps之间的通信协议的时候,即便开启了enable_tls = true,frpc发起websocket握手的时候也是http请求,并不是https。如下

image

在关闭了tls也就是没有设置enable_tls = true的时候,可以看到websocket握手后的通信内容

image

即使我在frps.ini设置了only_tls = true,握手过程也没有tls参与

image

在使用tcp作为frpc和frps之间的协议的时候,如下图,是有完整的tls握手的,除了SNI外我们看不到任何的信息

所以我认为 1.frpc和frps之间的websoket协议并不完整支持tls 2.enable_tls = true在websocket协议的情况下工作的不一样

-------配置文件-----

---frps.ini--- [common] bind_port = 7000 kcp_bind_port = 7000 tls_only = true

---frpc.ini--- [common] server_addr = 127.0.0.1 server_port = 7000 protocol = websocket tls_enable = true

[WSS_test] type = tcp local_ip = 127.0.0.1 local_port = 2345 remote_port = 7890

Describe alternatives you've considered

Affected area

  • Docs[ ] Installation[x] Performance and Scalability[x] Security[ ] User Experience[ ] Test and Release[ ] Developer Infrastructure[ ] Client Plugin[ ] Server Plugin[ ] Extensions[ ] Others

我也发现此问题 通过http建立wss通道 正常来说这种会有安全问题 中间人攻击 所以只能这样了

<!-- gh-comment-id:3052884020 --> @happytrudy commented on GitHub (Jul 9, 2025): > ### Describe the feature request > 由于有高层转发的需求,所以在frpc和frps的通信协议的选项我只能选择websocket 在使用webscoket作为frpc和frps之间的通信协议的时候,即便开启了`enable_tls = true`,frpc发起websocket握手的时候也是http请求,并不是https。如下 > > <img alt="image" width="1386" src="https://user-images.githubusercontent.com/21095700/170632663-72a44705-fd97-464a-b1c2-462e4c66221a.png"> > > 在关闭了tls也就是没有设置`enable_tls = true`的时候,可以看到websocket握手后的通信内容 > > <img alt="image" width="1398" src="https://user-images.githubusercontent.com/21095700/170632834-d797dc61-68a1-4dd0-b45d-1d6f377070d0.png"> > > 即使我在frps.ini设置了`only_tls = true`,握手过程也没有tls参与 > > <img alt="image" width="1398" src="https://user-images.githubusercontent.com/21095700/170632973-55ac363d-c16c-416b-a126-9cdbb652cee3.png"> > > 在使用tcp作为frpc和frps之间的协议的时候,如下图,是有完整的tls握手的,除了SNI外我们看不到任何的信息 > > 所以我认为 `1.frpc和frps之间的websoket协议并不完整支持tls` `2.enable_tls = true在websocket协议的情况下工作的不一样` > > -------配置文件----- > > ---frps.ini--- [common] bind_port = 7000 kcp_bind_port = 7000 tls_only = true > > ---frpc.ini--- [common] server_addr = 127.0.0.1 server_port = 7000 protocol = websocket tls_enable = true > > [WSS_test] type = tcp local_ip = 127.0.0.1 local_port = 2345 remote_port = 7890 > > ### Describe alternatives you've considered > 无 > > ### Affected area > * [ ] Docs[ ] Installation[x] Performance and Scalability[x] Security[ ] User Experience[ ] Test and Release[ ] Developer Infrastructure[ ] Client Plugin[ ] Server Plugin[ ] Extensions[ ] Others 我也发现此问题 通过http建立wss通道 正常来说这种会有安全问题 中间人攻击 所以只能这样了
Author
Owner

@aa51513 commented on GitHub (Jul 10, 2025):

Describe the feature request

由于有高层转发的需求,所以在frpc和frps的通信协议的选项我只能选择websocket 在使用webscoket作为frpc和frps之间的通信协议的时候,即便开启了enable_tls = true,frpc发起websocket握手的时候也是http请求,并不是https。如下
image
在关闭了tls也就是没有设置enable_tls = true的时候,可以看到websocket握手后的通信内容
image
即使我在frps.ini设置了only_tls = true,握手过程也没有tls参与
image
在使用tcp作为frpc和frps之间的协议的时候,如下图,是有完整的tls握手的,除了SNI外我们看不到任何的信息
所以我认为 1.frpc和frps之间的websoket协议并不完整支持tls 2.enable_tls = true在websocket协议的情况下工作的不一样
-------配置文件-----
---frps.ini--- [common] bind_port = 7000 kcp_bind_port = 7000 tls_only = true
---frpc.ini--- [common] server_addr = 127.0.0.1 server_port = 7000 protocol = websocket tls_enable = true
[WSS_test] type = tcp local_ip = 127.0.0.1 local_port = 2345 remote_port = 7890

Describe alternatives you've considered

Affected area

  • Docs[ ] Installation[x] Performance and Scalability[x] Security[ ] User Experience[ ] Test and Release[ ] Developer Infrastructure[ ] Client Plugin[ ] Server Plugin[ ] Extensions[ ] Others

我也发现此问题 通过http建立wss通道 正常来说这种会有安全问题 中间人攻击 所以只能这样了

This issue is quite clear. In summary: frpc supports acting as a WSS client, but frps does not support acting as a WSS server. Therefore, when using the WSS protocol, it is necessary to add a TLS intermediary layer (such as Nginx) as a reverse proxy in front of frps. Otherwise, the connection will fail.
这个问题非常明显,总结而言就是:frpc支持作为wss客户端,但frps不支持作为wss服务端,所以在使用wss协议的时候,需要通过反向代理(例如nginx)在frps之前,添加tls的中间层,否则就会无法连接。

<!-- gh-comment-id:3054804395 --> @aa51513 commented on GitHub (Jul 10, 2025): > > ### Describe the feature request > > 由于有高层转发的需求,所以在frpc和frps的通信协议的选项我只能选择websocket 在使用webscoket作为frpc和frps之间的通信协议的时候,即便开启了`enable_tls = true`,frpc发起websocket握手的时候也是http请求,并不是https。如下 > > <img alt="image" width="1386" src="https://user-images.githubusercontent.com/21095700/170632663-72a44705-fd97-464a-b1c2-462e4c66221a.png"> > > 在关闭了tls也就是没有设置`enable_tls = true`的时候,可以看到websocket握手后的通信内容 > > <img alt="image" width="1398" src="https://user-images.githubusercontent.com/21095700/170632834-d797dc61-68a1-4dd0-b45d-1d6f377070d0.png"> > > 即使我在frps.ini设置了`only_tls = true`,握手过程也没有tls参与 > > <img alt="image" width="1398" src="https://user-images.githubusercontent.com/21095700/170632973-55ac363d-c16c-416b-a126-9cdbb652cee3.png"> > > 在使用tcp作为frpc和frps之间的协议的时候,如下图,是有完整的tls握手的,除了SNI外我们看不到任何的信息 > > 所以我认为 `1.frpc和frps之间的websoket协议并不完整支持tls` `2.enable_tls = true在websocket协议的情况下工作的不一样` > > -------配置文件----- > > ---frps.ini--- [common] bind_port = 7000 kcp_bind_port = 7000 tls_only = true > > ---frpc.ini--- [common] server_addr = 127.0.0.1 server_port = 7000 protocol = websocket tls_enable = true > > [WSS_test] type = tcp local_ip = 127.0.0.1 local_port = 2345 remote_port = 7890 > > ### Describe alternatives you've considered > > 无 > > ### Affected area > > > > > > * [ ] Docs[ ] Installation[x] Performance and Scalability[x] Security[ ] User Experience[ ] Test and Release[ ] Developer Infrastructure[ ] Client Plugin[ ] Server Plugin[ ] Extensions[ ] Others > > 我也发现此问题 通过http建立wss通道 正常来说这种会有安全问题 中间人攻击 所以只能这样了 This issue is quite clear. In summary: `frpc` supports acting as a WSS client, but `frps` does not support acting as a WSS server. Therefore, when using the WSS protocol, it is necessary to add a TLS intermediary layer (such as Nginx) as a reverse proxy in front of `frps`. Otherwise, the connection will fail. 这个问题非常明显,总结而言就是:frpc支持作为wss客户端,但frps不支持作为wss服务端,所以在使用wss协议的时候,需要通过反向代理(例如nginx)在frps之前,添加tls的中间层,否则就会无法连接。
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#2356
No description provided.