Frp: 内网穿透tomcat9后无法连接里面的websocket服务

Created on 15 Jan 2021  ·  7Comments  ·  Source: fatedier/frp

内网穿透部署于 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 [这里也不确定该填什么端口]

Most helpful comment

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

All 7 comments

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

你应用访问的地址是什么?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

你应用访问的地址是什么?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

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

image

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

Upgrade: websocket
Connection: Upgrade

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

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

泪目啊,终于修复了:(

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jwangkun picture jwangkun  ·  3Comments

gao270615179 picture gao270615179  ·  3Comments

wangchong666 picture wangchong666  ·  4Comments

AngryBaby picture AngryBaby  ·  3Comments

wztx picture wztx  ·  3Comments