[GH-ISSUE #2189] 内网穿透tomcat9后无法连接里面的websocket服务 #1745

Closed
opened 2026-05-05 13:07:17 -06:00 by gitea-mirror · 7 comments
Owner

Originally created by @dekingorg on GitHub (Jan 15, 2021).
Original GitHub issue: https://github.com/fatedier/frp/issues/2189

内网穿透部署于 termux 里的 tomcat9服务器,无法连接里面我写的websocket接口.我用在局域网下直接访问termux里这个项目是正常的,把这个项目直接部署到外网服务器再在本地访问也是正常的,说明项目代码没有问题。

但是用 frp 内网映射到外网后就是无法连接。

我查看日志发现能触发 onOpen
但是报 java.io.EOFException 异常(错误代码 1006 )

tomcat版本:9.0.41
服务端frp版本:frp_0.34.3_linux_amd64
客户端frp版本: frp_0.34.3_linux_arm64

大佬们帮我康康 frp 配置有没有什么问题:

frps.ini
[common]
bind_port = 7000
log_file = ./frps.log
log_level = info
log_max_days = 3
vhost_http_port = 8080

frpc.ini
[common]
server_addr = 公网服务器 ip
server_port = 7000

[web]
type = http
local_ip = 127.0.0.1
local_port = 8080
custom_domains = 公网服务器 ip
remote_port = 8080

[websocket]
type = tcp
local_ip = 127.0.0.1
local_port = 80 [不知道 tomcat 里的 websocket 端口是多少谷歌了下说是 80]
use_encryption = false
use_compression = false
custom_domains = 公网服务器 ip
remote_port = 4567 [这里也不确定该填什么端口]

Originally created by @dekingorg on GitHub (Jan 15, 2021). Original GitHub issue: https://github.com/fatedier/frp/issues/2189 内网穿透部署于 termux 里的 tomcat9服务器,无法连接里面我写的websocket接口.我用在局域网下直接访问termux里这个项目是正常的,把这个项目直接部署到外网服务器再在本地访问也是正常的,说明项目代码没有问题。 但是用 frp 内网映射到外网后就是无法连接。 我查看日志发现能触发 onOpen 但是报 java.io.EOFException 异常(错误代码 1006 ) ------------------------------------------- tomcat版本:9.0.41 服务端frp版本:frp_0.34.3_linux_amd64 客户端frp版本: frp_0.34.3_linux_arm64 ------------------------------------------- 大佬们帮我康康 frp 配置有没有什么问题: frps.ini [common] bind_port = 7000 log_file = ./frps.log log_level = info log_max_days = 3 vhost_http_port = 8080 ------------------------------------------- frpc.ini [common] server_addr = 公网服务器 ip server_port = 7000 [web] type = http local_ip = 127.0.0.1 local_port = 8080 custom_domains = 公网服务器 ip remote_port = 8080 [websocket] type = tcp local_ip = 127.0.0.1 local_port = 80 [不知道 tomcat 里的 websocket 端口是多少谷歌了下说是 80] use_encryption = false use_compression = false custom_domains = 公网服务器 ip remote_port = 4567 [这里也不确定该填什么端口]
Author
Owner

@yuyulei commented on GitHub (Jan 15, 2021):

你应用访问的地址是什么?frp 侧有日志吗?

<!-- gh-comment-id:760764406 --> @yuyulei commented on GitHub (Jan 15, 2021): 你应用访问的地址是什么?frp 侧有日志吗?
Author
Owner

@dekingorg commented on GitHub (Jan 15, 2021):

你应用访问的地址是什么?frp 侧有日志吗?
地址是149.28.130.171:8080/queryAlipayServer/queryAlipay

frpc.log:
2021/01/15 09:41:48 [I] [service.go:288] [217a0a2ff932cc8d] login to server succ ess, get run id [217a0a2ff932cc8d], server udp port [0] 2021/01/15 09:41:48 [I] [proxy_manager.go:144] [217a0a2ff932cc8d] proxy added: [ web websocket] 2021/01/15 09:41:48 [I] [control.go:180] [217a0a2ff932cc8d] [web] start proxy su ccess 2021/01/15 09:41:48 [I] [control.go:180] [217a0a2ff932cc8d] [websocket] start pr oxy success 2021/01/15 09:42:53 [E] [proxy.go:793] [217a0a2ff932cc8d] [web socket] connect to local service [127.0.0.1:80] error: dial tcp 127.0.0.1:80: co nnect: connection refused 2021/01/15 09:42:58 [E] [control.go:158] [217a0a2ff932cc8d] work connection clos ed before response StartWorkConn message: EOF 2021/01/15 09:42:58 [I] [control.go:276] [217a0a2ff932cc8d] control writer is cl osing 2021/01/15 09:42:58 [I] [service.go:174] [217a0a2ff932cc8d] try to reconnect to server... 2021/01/15 09:42:58 [E] [control.go:158] [217a0a2ff932cc8d] work connection clos ed before response StartWorkConn message: EOF 2021/01/15 09:42:58 [I] [visitor_manager.go:60] [217a0a2ff932cc8d] gracefully sh utdown visitor manager 2021/01/15 09:42:58 [W] [service.go:177] [217a0a2ff932cc8d] reconnect to server error: dial tcp 149.28.130.171:7000: connect: connection refused 2021/01/15 09:43:00 [I] [service.go:174] [217a0a2ff932cc8d] try to reconnect to server... 2021/01/15 09:43:46 [W] [service.go:177] [217a0a2ff932cc8d] reconnect to server error: dial tcp 149.28.130.171:7000: connect: connection refused 2021/01/15 09:44:04 [I] [service.go:174] [217a0a2ff932cc8d] try to reconnect to server... 2021/01/15 09:45:27 [W] [service.go:177] [217a0a2ff932cc8d] reconnect to server error: dial tcp 149.28.130.171:7000: connect: connection refused
frps.log:
2021/01/15 09:45:36 [I] [service.go:190] frps tcp listen on 0.0.0.0:7000 2021/01/15 09:45:36 [I] [service.go:232] http service listen on 0.0.0.0:8080 2021/01/15 09:45:36 [I] [root.go:215] start frps success 2021/01/15 09:45:44 [W] [http.go:86] do http proxy request error: no such domain: 149.28.130.171 /queryAlipayServer/queryAlipay 2021/01/15 09:45:49 [W] [http.go:86] do http proxy request error: no such domain: 149.28.130.171 /queryAlipayServer/queryAlipay 2021/01/15 09:46:16 [I] [service.go:444] [217a0a2ff932cc8d] client login info: ip [111.1.200.110:15104] version [0.34.3] hostname [] o$ 2021/01/15 09:46:46 [I] [control.go:309] [217a0a2ff932cc8d] control writer is closing 2021/01/15 09:46:46 [I] [control.go:384] [217a0a2ff932cc8d] client exit success

<!-- gh-comment-id:760789141 --> @dekingorg commented on GitHub (Jan 15, 2021): > 你应用访问的地址是什么?frp 侧有日志吗? 地址是149.28.130.171:8080/queryAlipayServer/queryAlipay frpc.log: `2021/01/15 09:41:48 [I] [service.go:288] [217a0a2ff932cc8d] login to server succ ess, get run id [217a0a2ff932cc8d], server udp port [0] 2021/01/15 09:41:48 [I] [proxy_manager.go:144] [217a0a2ff932cc8d] proxy added: [ web websocket] 2021/01/15 09:41:48 [I] [control.go:180] [217a0a2ff932cc8d] [web] start proxy su ccess 2021/01/15 09:41:48 [I] [control.go:180] [217a0a2ff932cc8d] [websocket] start pr oxy success 2021/01/15 09:42:53 [E] [proxy.go:793] [217a0a2ff932cc8d] [web socket] connect to local service [127.0.0.1:80] error: dial tcp 127.0.0.1:80: co nnect: connection refused 2021/01/15 09:42:58 [E] [control.go:158] [217a0a2ff932cc8d] work connection clos ed before response StartWorkConn message: EOF 2021/01/15 09:42:58 [I] [control.go:276] [217a0a2ff932cc8d] control writer is cl osing 2021/01/15 09:42:58 [I] [service.go:174] [217a0a2ff932cc8d] try to reconnect to server... 2021/01/15 09:42:58 [E] [control.go:158] [217a0a2ff932cc8d] work connection clos ed before response StartWorkConn message: EOF 2021/01/15 09:42:58 [I] [visitor_manager.go:60] [217a0a2ff932cc8d] gracefully sh utdown visitor manager 2021/01/15 09:42:58 [W] [service.go:177] [217a0a2ff932cc8d] reconnect to server error: dial tcp 149.28.130.171:7000: connect: connection refused 2021/01/15 09:43:00 [I] [service.go:174] [217a0a2ff932cc8d] try to reconnect to server... 2021/01/15 09:43:46 [W] [service.go:177] [217a0a2ff932cc8d] reconnect to server error: dial tcp 149.28.130.171:7000: connect: connection refused 2021/01/15 09:44:04 [I] [service.go:174] [217a0a2ff932cc8d] try to reconnect to server... 2021/01/15 09:45:27 [W] [service.go:177] [217a0a2ff932cc8d] reconnect to server error: dial tcp 149.28.130.171:7000: connect: connection refused ` frps.log: `2021/01/15 09:45:36 [I] [service.go:190] frps tcp listen on 0.0.0.0:7000 2021/01/15 09:45:36 [I] [service.go:232] http service listen on 0.0.0.0:8080 2021/01/15 09:45:36 [I] [root.go:215] start frps success 2021/01/15 09:45:44 [W] [http.go:86] do http proxy request error: no such domain: 149.28.130.171 /queryAlipayServer/queryAlipay 2021/01/15 09:45:49 [W] [http.go:86] do http proxy request error: no such domain: 149.28.130.171 /queryAlipayServer/queryAlipay 2021/01/15 09:46:16 [I] [service.go:444] [217a0a2ff932cc8d] client login info: ip [111.1.200.110:15104] version [0.34.3] hostname [] o$ 2021/01/15 09:46:46 [I] [control.go:309] [217a0a2ff932cc8d] control writer is closing 2021/01/15 09:46:46 [I] [control.go:384] [217a0a2ff932cc8d] client exit success `
Author
Owner

@dekingorg commented on GitHub (Jan 15, 2021):

你应用访问的地址是什么?frp 侧有日志吗?

大佬这条信息啥意思?是不是线索,帮我康康

2021/01/15 09:53:50 [W] [http.go:86] do http proxy request error: backend tried to switch protocol "" when "websocket" was requested

<!-- gh-comment-id:760793257 --> @dekingorg commented on GitHub (Jan 15, 2021): > 你应用访问的地址是什么?frp 侧有日志吗? 大佬这条信息啥意思?是不是线索,帮我康康 2021/01/15 09:53:50 [W] [http.go:86] do http proxy request error: backend tried to switch protocol "" when "websocket" was requested
Author
Owner

@dekingorg commented on GitHub (Jan 15, 2021):

你应用访问的地址是什么?frp 侧有日志吗?

image

<!-- gh-comment-id:760797393 --> @dekingorg commented on GitHub (Jan 15, 2021): > 你应用访问的地址是什么?frp 侧有日志吗? ![image](https://user-images.githubusercontent.com/77146161/104711224-08223780-575c-11eb-871a-f28680e130a2.png)
Author
Owner

@fatedier commented on GitHub (Jan 17, 2021):

确保你的请求包含了以下 HTTP header

Upgrade: websocket
Connection: Upgrade
<!-- gh-comment-id:761807988 --> @fatedier commented on GitHub (Jan 17, 2021): 确保你的请求包含了以下 HTTP header ``` Upgrade: websocket Connection: Upgrade ```
Author
Owner

@yuyulei commented on GitHub (Jan 21, 2021):

一个 websocket 的 bug 刚被修复 #2199 你试下新的版本 v0.35.0

<!-- gh-comment-id:764211801 --> @yuyulei commented on GitHub (Jan 21, 2021): 一个 websocket 的 bug 刚被修复 #2199 你试下新的版本 v0.35.0
Author
Owner

@dekingorg commented on GitHub (Jan 21, 2021):

一个 websocket 的 bug 刚被修复 #2199 你试下新的版本 v0.35.0

泪目啊,终于修复了:(

<!-- gh-comment-id:764456156 --> @dekingorg commented on GitHub (Jan 21, 2021): > 一个 websocket 的 bug 刚被修复 #2199 你试下新的版本 v0.35.0 泪目啊,终于修复了:(
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#1745
No description provided.