[GH-ISSUE #4762] frpc如何支持wss:// 协议 #3762

Closed
opened 2026-05-05 14:24:35 -06:00 by gitea-mirror · 12 comments
Owner

Originally created by @muzihuaner on GitHub (Apr 20, 2025).
Original GitHub issue: https://github.com/fatedier/frp/issues/4762

Bug Description

如题
准备把家里云pve 对接whmcs
用frp
结果novnc使用的是wss协议

frpc Version

1.60.1

frps Version

1.60.1

System Architecture

linux/amd64

Configurations

linux/amd64

Logs

No response

Steps to reproduce

...

Affected area

  • Docs
  • Installation
  • Performance and Scalability
  • Security
  • User Experience
  • Test and Release
  • Developer Infrastructure
  • Client Plugin
  • Server Plugin
  • Extensions
  • Others
Originally created by @muzihuaner on GitHub (Apr 20, 2025). Original GitHub issue: https://github.com/fatedier/frp/issues/4762 ### Bug Description 如题 准备把家里云pve 对接whmcs 用frp 结果novnc使用的是wss协议 ### frpc Version 1.60.1 ### frps Version 1.60.1 ### System Architecture linux/amd64 ### Configurations linux/amd64 ### Logs _No response_ ### Steps to reproduce 1. 2. 3. ... ### Affected area - [ ] Docs - [ ] Installation - [ ] Performance and Scalability - [ ] Security - [ ] User Experience - [ ] Test and Release - [ ] Developer Infrastructure - [ ] Client Plugin - [ ] Server Plugin - [ ] Extensions - [ ] Others
gitea-mirror 2026-05-05 14:24:35 -06:00
Author
Owner

@rebron1900 commented on GitHub (Apr 21, 2025):

我最近在NAS上起了个minIO,web界面在访问桶的文件列表时也是需要用到websocket,但是现在不知道怎么设置。🤣🤣

目前的配置文件是这样的

[[proxies]]
name = "miniow"
type = "https"
subdomain = "miniow"
[proxies.plugin]
type = "https2http"
localAddr = "192.168.1.12:40014"                                         
crtPath = "/frp/ssl/frp.crt"
keyPath = "/frp/ssl/frp.key"      
hostHeaderRewrite = "192.168.1.12"                                      
requestHeaders.set.x-from-where = "frp"
<!-- gh-comment-id:2817821042 --> @rebron1900 commented on GitHub (Apr 21, 2025): 我最近在NAS上起了个minIO,web界面在访问桶的文件列表时也是需要用到websocket,但是现在不知道怎么设置。🤣🤣 目前的配置文件是这样的 ``` [[proxies]] name = "miniow" type = "https" subdomain = "miniow" [proxies.plugin] type = "https2http" localAddr = "192.168.1.12:40014" crtPath = "/frp/ssl/frp.crt" keyPath = "/frp/ssl/frp.key" hostHeaderRewrite = "192.168.1.12" requestHeaders.set.x-from-where = "frp" ```
Author
Owner

@rebron1900 commented on GitHub (Apr 21, 2025):

试过用 requestHeaders.set 来改请求头,但是好像没用,如:

[[proxies]]
name = "miniow"
type = "https"
subdomain = "miniow"
[proxies.plugin]
type = "https2http"
localAddr = "192.168.1.12:40014"                                         
crtPath = "/frp/ssl/frp.crt"
keyPath = "/frp/ssl/frp.key"      
hostHeaderRewrite = "192.168.1.12"                                      
requestHeaders.set.x-from-where = "frp"

requestHeaders.set.Upgrade = "$http_upgrade"
requestHeaders.set.Connection = "upgrade"
<!-- gh-comment-id:2817824930 --> @rebron1900 commented on GitHub (Apr 21, 2025): 试过用 `requestHeaders.set` 来改请求头,但是好像没用,如: ``` [[proxies]] name = "miniow" type = "https" subdomain = "miniow" [proxies.plugin] type = "https2http" localAddr = "192.168.1.12:40014" crtPath = "/frp/ssl/frp.crt" keyPath = "/frp/ssl/frp.key" hostHeaderRewrite = "192.168.1.12" requestHeaders.set.x-from-where = "frp" requestHeaders.set.Upgrade = "$http_upgrade" requestHeaders.set.Connection = "upgrade" ```
Author
Owner

@muzihuaner commented on GitHub (Apr 21, 2025):

deepseek 给出的也是这个办法

<!-- gh-comment-id:2817848315 --> @muzihuaner commented on GitHub (Apr 21, 2025): deepseek 给出的也是这个办法
Author
Owner

@rebron1900 commented on GitHub (Apr 21, 2025):

我看到 https://github.com/fatedier/frp/issues/3162 这个issue里提到已经支持了,就是不知道如何开启,文档里好像也没细说。

<!-- gh-comment-id:2817848368 --> @rebron1900 commented on GitHub (Apr 21, 2025): 我看到 https://github.com/fatedier/frp/issues/3162 这个issue里提到已经支持了,就是不知道如何开启,文档里好像也没细说。
Author
Owner

@luyang93 commented on GitHub (Apr 25, 2025):

我看到 #3162 这个issue里提到已经支持了,就是不知道如何开启,文档里好像也没细说。

只是说frpc与frps间可以通过websocket协议

# Communication protocol used to connect to server
# supports tcp, kcp, quic, websocket and wss now, default is tcp
transport.protocol = "tcp"
<!-- gh-comment-id:2829419151 --> @luyang93 commented on GitHub (Apr 25, 2025): > 我看到 [#3162](https://github.com/fatedier/frp/issues/3162) 这个issue里提到已经支持了,就是不知道如何开启,文档里好像也没细说。 只是说frpc与frps间可以通过websocket协议 ``` # Communication protocol used to connect to server # supports tcp, kcp, quic, websocket and wss now, default is tcp transport.protocol = "tcp" ```
Author
Owner

@rebron1900 commented on GitHub (Apr 25, 2025):

我看到 #3162 这个issue里提到已经支持了,就是不知道如何开启,文档里好像也没细说。

只是说frpc与frps间可以通过websocket协议

# Communication protocol used to connect to server
# supports tcp, kcp, quic, websocket and wss now, default is tcp
transport.protocol = "tcp"

大佬,https2http插件没法启用wss吗

<!-- gh-comment-id:2830365390 --> @rebron1900 commented on GitHub (Apr 25, 2025): > > 我看到 [#3162](https://github.com/fatedier/frp/issues/3162) 这个issue里提到已经支持了,就是不知道如何开启,文档里好像也没细说。 > > 只是说frpc与frps间可以通过websocket协议 > > ``` > # Communication protocol used to connect to server > # supports tcp, kcp, quic, websocket and wss now, default is tcp > transport.protocol = "tcp" > ``` 大佬,https2http插件没法启用wss吗
Author
Owner

@luyang93 commented on GitHub (Apr 26, 2025):

我看到 #3162 这个issue里提到已经支持了,就是不知道如何开启,文档里好像也没细说。

只是说frpc与frps间可以通过websocket协议

# Communication protocol used to connect to server
# supports tcp, kcp, quic, websocket and wss now, default is tcp
transport.protocol = "tcp"

大佬,https2http插件没法启用wss吗

a23455a737/test/e2e/v1/basic/client_server.go (L126-L134)

自己看测试用例
type是tcp
如果是wss,proxies.plugin为http(s?)2https,用localAddr和hostHeaderRewrite处理WebSockets over SSL/TLS中的SSL/TLS配置

<!-- gh-comment-id:2831828643 --> @luyang93 commented on GitHub (Apr 26, 2025): > > > 我看到 [#3162](https://github.com/fatedier/frp/issues/3162) 这个issue里提到已经支持了,就是不知道如何开启,文档里好像也没细说。 > > > > > > 只是说frpc与frps间可以通过websocket协议 > > ``` > > # Communication protocol used to connect to server > > # supports tcp, kcp, quic, websocket and wss now, default is tcp > > transport.protocol = "tcp" > > ``` > > 大佬,https2http插件没法启用wss吗 https://github.com/fatedier/frp/blob/a23455a73799670d31f7bfaeebf12ccd793a1391/test/e2e/v1/basic/client_server.go#L126-L134 自己看测试用例 type是tcp 如果是wss,proxies.plugin为http(s?)2https,用localAddr和hostHeaderRewrite处理WebSockets over SSL/TLS中的SSL/TLS配置
Author
Owner

@github-actions[bot] commented on GitHub (May 11, 2025):

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

<!-- gh-comment-id:2869293478 --> @github-actions[bot] commented on GitHub (May 11, 2025): Issues go stale after 14d of inactivity. Stale issues rot after an additional 3d of inactivity and eventually close.
Author
Owner

@rebron1900 commented on GitHub (Aug 13, 2025):

我看到 #3162 这个issue里提到已经支持了,就是不知道如何开启,文档里好像也没细说。

只是说frpc与frps间可以通过websocket协议

# Communication protocol used to connect to server
# supports tcp, kcp, quic, websocket and wss now, default is tcp
transport.protocol = "tcp"

大佬,https2http插件没法启用wss吗

frp/test/e2e/v1/basic/client_server.go

Lines 126 to 134 in a23455a

  	client2: fmt.Sprintf(` 
  		[[proxies]] 
  		name = "wss2ws" 
  		type = "tcp" 
  		remotePort = %d 
  		[proxies.plugin] 
  		type = "https2http" 
  		localAddr = "127.0.0.1:{{ .%s }}" 
  	`, wssPort, consts.PortServerName), 

自己看测试用例 type是tcp 如果是wss,proxies.plugin为http(s?)2https,用localAddr和hostHeaderRewrite处理WebSockets over SSL/TLS中的SSL/TLS配置

大佬,你提到的这个我有点看不明白 😅

<!-- gh-comment-id:3183026741 --> @rebron1900 commented on GitHub (Aug 13, 2025): > > > > 我看到 [#3162](https://github.com/fatedier/frp/issues/3162) 这个issue里提到已经支持了,就是不知道如何开启,文档里好像也没细说。 > > > > > > > > > 只是说frpc与frps间可以通过websocket协议 > > > ``` > > > # Communication protocol used to connect to server > > > # supports tcp, kcp, quic, websocket and wss now, default is tcp > > > transport.protocol = "tcp" > > > ``` > > > > > > 大佬,https2http插件没法启用wss吗 > > [frp/test/e2e/v1/basic/client_server.go](https://github.com/fatedier/frp/blob/a23455a73799670d31f7bfaeebf12ccd793a1391/test/e2e/v1/basic/client_server.go#L126-L134) > > Lines 126 to 134 in [a23455a](/fatedier/frp/commit/a23455a73799670d31f7bfaeebf12ccd793a1391) > > client2: fmt.Sprintf(` > [[proxies]] > name = "wss2ws" > type = "tcp" > remotePort = %d > [proxies.plugin] > type = "https2http" > localAddr = "127.0.0.1:{{ .%s }}" > `, wssPort, consts.PortServerName), > 自己看测试用例 type是tcp 如果是wss,proxies.plugin为http(s?)2https,用localAddr和hostHeaderRewrite处理WebSockets over SSL/TLS中的SSL/TLS配置 大佬,你提到的这个我有点看不明白 😅
Author
Owner

@chenbihao commented on GitHub (Sep 10, 2025):

不知道是否有反代? 我默认配置tcp转发,是可以穿透wss给服务的,在nginx中是这样配置的:

# 关键:添加 WebSocket 支持(终端连接使用
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";

配置完后,页面的wss请求是可以用的,例如一些网页的vnc、网页的docker终端之类的

<!-- gh-comment-id:3274828010 --> @chenbihao commented on GitHub (Sep 10, 2025): 不知道是否有反代? 我默认配置tcp转发,是可以穿透wss给服务的,在nginx中是这样配置的: ``` # 关键:添加 WebSocket 支持(终端连接使用 proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; ``` 配置完后,页面的wss请求是可以用的,例如一些网页的vnc、网页的docker终端之类的
Author
Owner

@rebron1900 commented on GitHub (Sep 10, 2025):

不知道是否有反代? 我默认配置tcp转发,是可以穿透wss给服务的,在nginx中是这样配置的:

# 关键:添加 WebSocket 支持(终端连接使用
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";

配置完后,页面的wss请求是可以用的,例如一些网页的vnc、网页的docker终端之类的

这个是在frpc端还是frps端呢

另外因为我现在所有端口统一都是使用一个端口来的,frps那边只负责把所有请求转发到frpc上。

<!-- gh-comment-id:3275068307 --> @rebron1900 commented on GitHub (Sep 10, 2025): > 不知道是否有反代? 我默认配置tcp转发,是可以穿透wss给服务的,在nginx中是这样配置的: > > ``` > # 关键:添加 WebSocket 支持(终端连接使用 > proxy_set_header Upgrade $http_upgrade; > proxy_set_header Connection "upgrade"; > ``` > > 配置完后,页面的wss请求是可以用的,例如一些网页的vnc、网页的docker终端之类的 这个是在frpc端还是frps端呢 另外因为我现在所有端口统一都是使用一个端口来的,frps那边只负责把所有请求转发到frpc上。
Author
Owner

@chenbihao commented on GitHub (Sep 10, 2025):

这个是在frpc端还是frps端呢

另外因为我现在所有端口统一都是使用一个端口来的,frps那边只负责把所有请求转发到frpc上。

我是在s端有个反代,如果tcp类型且有反代的话考虑是否缺失这个头

如果你没有的话那应该不是这个问题,我没配过https2http还真不懂lol

<!-- gh-comment-id:3275473926 --> @chenbihao commented on GitHub (Sep 10, 2025): > 这个是在frpc端还是frps端呢 > > 另外因为我现在所有端口统一都是使用一个端口来的,frps那边只负责把所有请求转发到frpc上。 我是在s端有个反代,如果tcp类型且有反代的话考虑是否缺失这个头 如果你没有的话那应该不是这个问题,我没配过https2http还真不懂lol
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#3762
No description provided.