fatedier / frp

A fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet.
Apache License 2.0
81.44k stars 12.82k forks source link

服务端和客户端都正常连接,但穿透访问网站失败 #973

Closed yflwz closed 5 years ago

yflwz commented 5 years ago

Issue is only used for submiting bug report and documents typo. If there are same issues or answers can be found in documents, we will close it directly. (为了节约时间,提高处理问题的效率,不按照格式填写的 issue 将会直接关闭。)

Use the commands below to provide key information from your environment: You do NOT have to include this information if this is a FEATURE REQUEST

What version of frp are you using (./frpc -v or ./frps -v)? Frps version 0.21.0 Frpc version 0.21.0

What operating system and processor architecture are you using (go env)? CentOS Linux release 7.5.1804 (Core)

Configures you used: frps.ini [common] bind_addr = 0.0.0.0 bind_port = 19000 kcp_bind_port = 19000 dashboard_port = 19001 dashboard_user = ** dashboard_pwd = ** vhost_http_port = 19080 vhost_https_port = 19443 log_file = ./frps.log log_level = info log_max_days = 3

token = **

max_pool_count = 50 tcp_mux = true subdomain_host = a***.ml

frpc.ini [common] server_addr = a***.ml server_port = 19000

token = **

log_file = ./frpc.log log_level = info log_max_days = 3

[http-test] type = http local_ip = 127.0.0.1 local_port = 80

remote_port = 19080

subdomain = test

Steps to reproduce the issue: 1.服务器日志和web控制面板(dashboard)可以看出已经连接上并建立透传规则; 2.附上服务端日志 frps.log 2018/11/14 00:06:53 [I] [service.go:130] frps tcp listen on 0.0.0.0:19000 2018/11/14 00:06:53 [I] [service.go:139] frps kcp listen on udp 0.0.0.0:19000 2018/11/14 00:06:53 [I] [service.go:172] http service listen on 0.0.0.0:19080 2018/11/14 00:06:53 [I] [service.go:193] https service listen on 0.0.0.0:19443 2018/11/14 00:06:53 [I] [service.go:216] Dashboard listen on 0.0.0.0:19001 2018/11/14 00:06:53 [I] [root.go:207] Start frps success 2018/11/14 00:29:18 [I] [service.go:319] client login info: ip [.236..*:26320] version [0.21.0] hostname [] os [linux] arch [amd64] 2018/11/14 00:29:18 [I] [proxy.go:291] [5e51079cf47442f5] [http-test] http proxy listen for host [test.a***.ml] location [] 2018/11/14 00:29:18 [I] [control.go:335] [5e51079cf47442f5] new proxy [http-test] success 2018/11/14 00:30:05 [I] [dashboard_api.go:67] Http request: [/api/serverinfo] 2018/11/14 00:30:05 [I] [dashboard_api.go:64] Http response [/api/serverinfo]: code [0] 2018/11/14 00:30:05 [I] [dashboard_api.go:178] Http request: [/api/proxy/http] 2018/11/14 00:30:05 [I] [dashboard_api.go:174] Http response [/api/proxy/http]: code [0] 2018/11/14 00:30:05 [I] [dashboard_api.go:175] /api/proxy/http 2018/11/14 00:30:05 [I] [dashboard_api.go:176] 2018/11/14 00:30:07 [I] [dashboard_api.go:309] Http request: [/api/traffic/http-test] 2018/11/14 00:30:07 [I] [dashboard_api.go:307] Http response [/api/traffic/http-test]: code [0] 3.附上客户端日志 2018/11/14 00:29:17 [I] [proxy_manager.go:300] proxy removed: [] 2018/11/14 00:29:17 [I] [proxy_manager.go:310] proxy added: [http-test] 2018/11/14 00:29:17 [I] [proxy_manager.go:333] visitor removed: [] 2018/11/14 00:29:17 [I] [proxy_manager.go:342] visitor added: [] 2018/11/14 00:29:18 [I] [control.go:246] [5e51079cf47442f5] login to server success, get run id [5e51079cf47442f5], server udp port [0] 2018/11/14 00:29:18 [I] [control.go:169] [5e51079cf47442f5] [http-test] start proxy success

Describe the results you received: 用不同的浏览器打开http://test.a***.com报404错误,但直接用客户端的IP地址访问网站是正常的。

Describe the results you expected: 用域名test.a***.com能直接访问客户端的网站

Additional information you deem important (e.g. issue happens only occasionally):

Can you point out what caused this issue (optional)

yflwz commented 5 years ago

把日志级别修改为trace,能看到心跳检测也是正常的。 2018/11/14 00:50:28 [D] [control.go:340] [5e51079cf47442f5] send heartbeat to server 2018/11/14 00:50:28 [D] [control.go:361] [5e51079cf47442f5] receive heartbeat from server 2018/11/14 00:50:58 [D] [control.go:340] [5e51079cf47442f5] send heartbeat to server 2018/11/14 00:50:58 [D] [control.go:361] [5e51079cf47442f5] receive heartbeat from server 2018/11/14 00:51:28 [D] [control.go:340] [5e51079cf47442f5] send heartbeat to server 2018/11/14 00:51:28 [D] [control.go:361] [5e51079cf47442f5] receive heartbeat from server

yflwz commented 5 years ago

停止客户端的时候最后报了一个错误,不知道有没有关系? 2018/11/14 00:56:41 [D] [control.go:246] [5e51079cf47442f5] control connection closed 2018/11/14 00:56:41 [I] [control.go:220] [5e51079cf47442f5] control writer is closing 2018/11/14 00:56:41 [I] [proxy.go:73] [5e51079cf47442f5] [http-test] proxy closing 2018/11/14 00:56:41 [I] [control.go:292] [5e51079cf47442f5] client exit success 2018/11/14 00:56:41 [D] [service.go:304] Accept new mux stream error: EOF

yflwz commented 5 years ago

现在发现用test.a***.com:19080能正常访问客户端网站,是什么原因导致?

yflwz commented 5 years ago

晕,手一抖鼠标按到关闭了。

SifuLi commented 5 years ago

我是时不时404,刷新又可以

yflwz commented 5 years ago

404建议先清一下浏览器的缓存再试,然后再查二边的日志。你这个和我的问题应该不一样。

yflwz commented 5 years ago

问题没人解答吗?其他人也没有碰到过这种情况?

x2c3z4 commented 5 years ago
遇到一样的问题了,client 报错
[E] [control.go:152] [785b68f6ab9cbf70] work connection closed, EOF
Milokita commented 5 years ago

会不会是服务器时延问题

yflwz commented 5 years ago

服务器延时不算高,才20多,也没有丢包。

Milokita commented 5 years ago

我也遇到了,work connection closed, EOF

Milokita commented 5 years ago

我的是访问过程中时不时中断

SeanDemo2017 commented 5 years ago

稍等,你的frpc 上,local_ip应该填你局域网的手动分配的ip,而不是127.0.0.1,再去试下 肖黎东(守护星) 邮箱:xiao940213@gmail.com 签名由 网易邮箱大师 定制 在2018年11月14日 00:39,yflwz 写道: Issue is only used for submiting bug report and documents typo. If there are same issues or answers can be found in documents, we will close it directly. (为了节约时间,提高处理问题的效率,不按照格式填写的 issue 将会直接关闭。) Use the commands below to provide key information from your environment: You do NOT have to include this information if this is a FEATURE REQUEST What version of frp are you using (./frpc -v or ./frps -v)? Frps version 0.21.0 Frpc version 0.21.0 What operating system and processor architecture are you using (go env)? CentOS Linux release 7.5.1804 (Core) Configures you used: frps.ini [common] bind_addr = 0.0.0.0 bind_port = 19000 kcp_bind_port = 19000 dashboard_port = 19001 dashboard_user = ** dashboard_pwd = ** vhost_http_port = 19080 vhost_https_port = 19443 log_file = ./frps.log log_level = info log_max_days = 3 #token = ** max_pool_count = 50 tcp_mux = true subdomain_host = a.ml frpc.ini [common] server_addr = a.ml server_port = 19000 #token = ** log_file = ./frpc.log log_level = info log_max_days = 3 [http-test] type = http local_ip = 127.0.0.1 local_port = 80 #remote_port = 19080 subdomain = test Steps to reproduce the issue: 1.服务器日志和web控制面板(dashboard)可以看出已经连接上并建立透传规则; 2.附上服务端日志 frps.log 2018/11/14 00:06:53 [I] [service.go:130] frps tcp listen on 0.0.0.0:19000 2018/11/14 00:06:53 [I] [service.go:139] frps kcp listen on udp 0.0.0.0:19000 2018/11/14 00:06:53 [I] [service.go:172] http service listen on 0.0.0.0:19080 2018/11/14 00:06:53 [I] [service.go:193] https service listen on 0.0.0.0:19443 2018/11/14 00:06:53 [I] [service.go:216] Dashboard listen on 0.0.0.0:19001 2018/11/14 00:06:53 [I] [root.go:207] Start frps success 2018/11/14 00:29:18 [I] [service.go:319] client login info: ip [35.236.181.119:26320] version [0.21.0] hostname [] os [linux] arch [amd64] 2018/11/14 00:29:18 [I] [proxy.go:291] [5e51079cf47442f5] [http-test] http proxy listen for host [test.a.ml] location [] 2018/11/14 00:29:18 [I] [control.go:335] [5e51079cf47442f5] new proxy [http-test] success 2018/11/14 00:30:05 [I] [dashboard_api.go:67] Http request: [/api/serverinfo] 2018/11/14 00:30:05 [I] [dashboard_api.go:64] Http response [/api/serverinfo]: code [0] 2018/11/14 00:30:05 [I] [dashboard_api.go:178] Http request: [/api/proxy/http] 2018/11/14 00:30:05 [I] [dashboard_api.go:174] Http response [/api/proxy/http]: code [0] 2018/11/14 00:30:05 [I] [dashboard_api.go:175] /api/proxy/http 2018/11/14 00:30:05 [I] [dashboard_api.go:176] 2018/11/14 00:30:07 [I] [dashboard_api.go:309] Http request: [/api/traffic/http-test] 2018/11/14 00:30:07 [I] [dashboard_api.go:307] Http response [/api/traffic/http-test]: code [0] 3.附上客户端日志 2018/11/14 00:29:17 [I] [proxy_manager.go:300] proxy removed: [] 2018/11/14 00:29:17 [I] [proxy_manager.go:310] proxy added: [http-test] 2018/11/14 00:29:17 [I] [proxy_manager.go:333] visitor removed: [] 2018/11/14 00:29:17 [I] [proxy_manager.go:342] visitor added: [] 2018/11/14 00:29:18 [I] [control.go:246] [5e51079cf47442f5] login to server success, get run id [5e51079cf47442f5], server udp port [0] 2018/11/14 00:29:18 [I] [control.go:169] [5e51079cf47442f5] [http-test] start proxy success Describe the results you received: 用不同的浏览器打开http://test.a.com报404错误,但直接用客户端的IP地址访问网站是正常的。 Describe the results you expected: 用域名test.a***.com能直接访问客户端的网站 Additional information you deem important (e.g. issue happens only occasionally): Can you point out what caused this issue (optional) — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

lengxii commented 5 years ago

服务端: 2018/12/01 09:20:33 [I] [service.go:128] frps tcp listen on 0.0.0.0:7000 2018/12/01 09:20:33 [I] [service.go:137] frps kcp listen on udp 0.0.0.0:7000 2018/12/01 09:20:33 [I] [service.go:161] http service listen on 0.0.0.0:8090 2018/12/01 09:20:33 [I] [service.go:182] https service listen on 0.0.0.0:4433 2018/12/01 09:20:33 [I] [service.go:205] Dashboard listen on 0.0.0.0:8000 2018/12/01 09:20:33 [I] [root.go:190] Start frps success 2018/12/01 09:22:23 [I] [dashboard_api.go:67] Http request: [/api/serverinfo] 2018/12/01 09:22:23 [I] [dashboard_api.go:64] Http response [/api/serverinfo]: code [0] 2018/12/01 09:22:27 [I] [dashboard_api.go:67] Http request: [/api/serverinfo] 2018/12/01 09:22:27 [I] [dashboard_api.go:64] Http response [/api/serverinfo]: code [0]

客户端: 2018/12/01 01:23:28 [I] [proxy_manager.go:300] proxy removed: [] 2018/12/01 01:23:28 [I] [proxy_manager.go:310] proxy added: [ip me] 2018/12/01 01:23:28 [I] [proxy_manager.go:333] visitor removed: [] 2018/12/01 01:23:28 [I] [proxy_manager.go:342] visitor added: [] 2018/12/01 01:23:38 [W] [control.go:113] login to server failed: i/o deadline reached

要怎么解决啊??

yflwz commented 5 years ago

好的,我明天试一下。

yflwz commented 5 years ago

修改了客户端配置里面的IP地址为内网IP还是一样的情况 frpc.ini [common] server_addr = a***.ml server_port = 19000

token = **

log_file = ./frpc.log log_level = info log_max_days = 3

[http-test] type = http local_ip = 192.168.2.23 local_port = 80

remote_port = 19080

subdomain = test

yflwz commented 5 years ago

服务端: 2018/12/01 09:20:33 [I] [service.go:128] frps tcp listen on 0.0.0.0:7000 2018/12/01 09:20:33 [I] [service.go:137] frps kcp listen on udp 0.0.0.0:7000 2018/12/01 09:20:33 [I] [service.go:161] http service listen on 0.0.0.0:8090 2018/12/01 09:20:33 [I] [service.go:182] https service listen on 0.0.0.0:4433 2018/12/01 09:20:33 [I] [service.go:205] Dashboard listen on 0.0.0.0:8000 2018/12/01 09:20:33 [I] [root.go:190] Start frps success 2018/12/01 09:22:23 [I] [dashboard_api.go:67] Http request: [/api/serverinfo] 2018/12/01 09:22:23 [I] [dashboard_api.go:64] Http response [/api/serverinfo]: code [0] 2018/12/01 09:22:27 [I] [dashboard_api.go:67] Http request: [/api/serverinfo] 2018/12/01 09:22:27 [I] [dashboard_api.go:64] Http response [/api/serverinfo]: code [0]

客户端: 2018/12/01 01:23:28 [I] [proxy_manager.go:300] proxy removed: [] 2018/12/01 01:23:28 [I] [proxy_manager.go:310] proxy added: [ip me] 2018/12/01 01:23:28 [I] [proxy_manager.go:333] visitor removed: [] 2018/12/01 01:23:28 [I] [proxy_manager.go:342] visitor added: [] 2018/12/01 01:23:38 [W] [control.go:113] login to server failed: i/o deadline reached

要怎么解决啊??

您这个是服务器和客户端时间相差太大导致连接失败。

yflwz commented 5 years ago

升级到了22新版本问题也没有解决。

yflwz commented 5 years ago

服务端日志: 2019/01/09 20:26:19 [I] [service.go:172] http service listen on 0.0.0.0:4480 2019/01/09 20:26:19 [I] [service.go:193] https service listen on 0.0.0.0:4443 2019/01/09 20:26:19 [I] [service.go:216] Dashboard listen on 0.0.0.0:19001 2019/01/09 20:26:19 [I] [root.go:210] Start frps success 2019/01/09 20:27:47 [I] [service.go:319] client login info: ip [xx.xx.xx.119:26624] version [0.22.0] hostname [] os [linux] arch [amd64] 2019/01/09 20:27:47 [D] [control.go:135] [900077cd66a8ac10] new work connection registered 2019/01/09 20:27:47 [I] [proxy.go:291] [900077cd66a8ac10] [web] http proxy listen for host [test.xxxx.ml] location [] 2019/01/09 20:27:47 [I] [control.go:335] [900077cd66a8ac10] new proxy [web] success 2019/01/09 20:27:47 [I] [proxy.go:370] [900077cd66a8ac10] [https] https proxy listen for host [test.xxxx.ml] 2019/01/09 20:27:47 [I] [control.go:335] [900077cd66a8ac10] new proxy [https] success 2019/01/09 20:28:17 [D] [control.go:344] [900077cd66a8ac10] receive heartbeat 2019/01/09 20:28:47 [D] [control.go:344] [900077cd66a8ac10] receive heartbeat 2019/01/09 20:29:17 [D] [control.go:344] [900077cd66a8ac10] receive heartbeat 2019/01/09 20:29:47 [D] [control.go:344] [900077cd66a8ac10] receive heartbeat 2019/01/09 20:30:17 [D] [control.go:344] [900077cd66a8ac10] receive heartbeat 2019/01/09 20:30:47 [D] [control.go:344] [900077cd66a8ac10] receive heartbeat

客户端日志: 2019/01/09 20:27:47 [I] [service.go:205] login to server success, get run id [900077cd66a8ac10], server udp port [0] 2019/01/09 20:27:47 [I] [proxy_manager.go:136] [900077cd66a8ac10] proxy added: [web https] 2019/01/09 20:27:47 [T] [proxy_wrapper.go:164] [900077cd66a8ac10] [web] change status from [new] to [wait start] 2019/01/09 20:27:47 [T] [proxy_wrapper.go:164] [900077cd66a8ac10] [https] change status from [new] to [wait start] 2019/01/09 20:27:47 [I] [control.go:143] [web] start proxy success 2019/01/09 20:27:47 [I] [control.go:143] [https] start proxy success 2019/01/09 20:28:17 [D] [control.go:248] send heartbeat to server 2019/01/09 20:28:17 [D] [control.go:269] receive heartbeat from server 2019/01/09 20:28:47 [D] [control.go:248] send heartbeat to server 2019/01/09 20:28:47 [D] [control.go:269] receive heartbeat from server 2019/01/09 20:29:17 [D] [control.go:248] send heartbeat to server

一切都很正常,不明白为什么访问客户端的网站必须加端口(test.xxxx.ml:4480),不能用80和443

yflwz commented 5 years ago

想了一下,直接在nginx做了反向代理,刚刚又试了一下,80端口访问可以啦。 附上nginx 配置,我是另外做的单独针对某个域名配置文件,xxx.ml是我的二级域名, server { listen 80; server_name *.xxx.ml; access_log /data/wwwlogs/xxx.ml_nginx.log combined; root /data/www/xxx; index index.jsp home.jsp login.jsp index.html index.htm index.jspx index.jhtml; location / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host:4480; proxy_set_header X-Nginx-Proxy true; proxy_set_header Connection ""; proxy_pass http://127.0.0.1:4480; } }

yflwz commented 5 years ago

443端口共用的问题还没想好怎么解决。

yflwz commented 5 years ago

server { listen 443 ssl http2; server_name *.xxx.ml; location / { proxy_pass https://127.0.0.1:4443; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host:4443; proxy_set_header X-Nginx-Proxy true; proxy_set_header Connection ""; } }