[GH-ISSUE #3495] Frpc 支持server_addr domain吗? #2793

Closed
opened 2026-05-05 13:48:06 -06:00 by gitea-mirror · 9 comments
Owner

Originally created by @commandoccz on GitHub (Jun 26, 2023).
Original GitHub issue: https://github.com/fatedier/frp/issues/3495

Bug Description

由于frp支持websocket,我就想将frps放在nginx后端,由nginx反代websocket到frps,出于安全考虑我在VPS上禁止了ip直接访问,因此frpc的server_addr 需要用到域名
frps.ini:
[common]
bind_addr = 0.0.0.0
bind_port = 7000
kcp_bind_port = 7000
dashboard_addr = 0.0.0.0
dashboard_port = 7500
dashboard_user = admin
dashboard_pwd = admin

frpc.ini:
[common]
server_addr = https://frpsocket-original.engineer.online
server_port = 443
protocol = websocket

[ssh]
type = tcp
local_ip = 127.0.0.1
local_port = 22
remote_port = 6000

frpc -c ./frpc.ini运行后报错:
[W] [service.go:131] login to server failed: dial tcp: lookup https://frpsocket-original.engineer.online: no such host dial tcp: lookup https://frpsocket-original.engineer.online: no such host

frpc Version

0.49.0

frps Version

0.49.0

System Architecture

Server:"Ubuntu ARM64";Client:"Win10_64bit/Ubuntu amd64"

Configurations

Reference to Bug Description

Logs

Server log:
image
其中:
2023/06/25 20:26:42 [D] [service.go:474] Accept new mux stream error: invalid protocol version
2023/06/25 20:26:42 [D] [service.go:474] Accept new mux stream error: invalid protocol version
2023/06/25 20:26:44 [D] [service.go:474] Accept new mux stream error: invalid protocol version

是我用浏览器访问的服务器响应,说明nginx已经转发了websocket

Client Log:
[W] [service.go:131] login to server failed: dial tcp: lookup https://frpsocket-original.engineer.online: no such host
dial tcp: lookup https://frpsocket-original.engineer.online: no such host

Steps to reproduce

Reference to Bug Description

Affected area

  • Docs
  • Installation
  • Performance and Scalability
  • Security
  • User Experience
  • Test and Release
  • Developer Infrastructure
  • Client Plugin
  • Server Plugin
  • Extensions
  • Others
Originally created by @commandoccz on GitHub (Jun 26, 2023). Original GitHub issue: https://github.com/fatedier/frp/issues/3495 ### Bug Description 由于frp支持websocket,我就想将frps放在nginx后端,由nginx反代websocket到frps,出于安全考虑我在VPS上禁止了ip直接访问,因此frpc的server_addr 需要用到域名 frps.ini: [common] bind_addr = 0.0.0.0 bind_port = 7000 kcp_bind_port = 7000 dashboard_addr = 0.0.0.0 dashboard_port = 7500 dashboard_user = admin dashboard_pwd = admin frpc.ini: [common] server_addr = https://frpsocket-original.engineer.online server_port = 443 protocol = websocket [ssh] type = tcp local_ip = 127.0.0.1 local_port = 22 remote_port = 6000 frpc -c ./frpc.ini运行后报错: `[W] [service.go:131] login to server failed: dial tcp: lookup https://frpsocket-original.engineer.online: no such host dial tcp: lookup https://frpsocket-original.engineer.online: no such host` ### frpc Version 0.49.0 ### frps Version 0.49.0 ### System Architecture Server:"Ubuntu ARM64";Client:"Win10_64bit/Ubuntu amd64" ### Configurations Reference to Bug Description ### Logs Server log: ![image](https://github.com/fatedier/frp/assets/76011848/f94b5a6b-b58e-4600-a0bc-6f2ff283bc8c) 其中: 2023/06/25 20:26:42 [D] [service.go:474] Accept new mux stream error: invalid protocol version 2023/06/25 20:26:42 [D] [service.go:474] Accept new mux stream error: invalid protocol version 2023/06/25 20:26:44 [D] [service.go:474] Accept new mux stream error: invalid protocol version 是我用浏览器访问的服务器响应,说明nginx已经转发了websocket Client Log: [W] [service.go:131] login to server failed: dial tcp: lookup https://frpsocket-original.engineer.online: no such host dial tcp: lookup https://frpsocket-original.engineer.online: no such host ### Steps to reproduce Reference to Bug Description ### Affected area - [ ] Docs - [ ] Installation - [ ] Performance and Scalability - [ ] Security - [X] User Experience - [ ] Test and Release - [ ] Developer Infrastructure - [ ] Client Plugin - [ ] Server Plugin - [ ] Extensions - [ ] Others
gitea-mirror 2026-05-05 13:48:06 -06:00
Author
Owner

@fatedier commented on GitHub (Jun 26, 2023):

server_addr does not need to include the protocol type.

<!-- gh-comment-id:1606493554 --> @fatedier commented on GitHub (Jun 26, 2023): `server_addr` does not need to include the protocol type.
Author
Owner

@commandoccz commented on GitHub (Jun 26, 2023):

T_T Still not working.......
frpc.ini:
[common]
server_addr = frpsocket-original.engineer.online
server_port = 443
protocol = websocket

[ssh]
type = tcp
local_ip = 127.0.0.1
local_port = 22
remote_port = 6000

root@instance-20220601-1259:~/frp# ./frpc -c ./frpc.ini
2023/06/26 10:49:52 [W] [service.go:131] login to server failed: bad status
bad status

root@instance-20220601-1259:~/frp# telnet frpsocket-original.engineer.online 443
Trying 138.18.32.239...
Connected to frpsocket-original.engineer.online.
Escape character is '^]'.
sss
HTTP/1.1 400 Bad Request
Server: nginx
Date: Mon, 26 Jun 2023 02:50:50 GMT
Content-Type: text/html

<!-- gh-comment-id:1606527923 --> @commandoccz commented on GitHub (Jun 26, 2023): T_T Still not working....... **frpc.ini:** **[common]** server_addr = frpsocket-original.engineer.online server_port = 443 protocol = websocket **[ssh]** type = tcp local_ip = 127.0.0.1 local_port = 22 remote_port = 6000 **root@instance-20220601-1259:~/frp# ./frpc -c ./frpc.ini** 2023/06/26 10:49:52 [W] [service.go:131] login to server failed: bad status bad status **root@instance-20220601-1259:~/frp# telnet frpsocket-original.engineer.online 443** Trying 138.18.32.239... Connected to frpsocket-original.engineer.online. Escape character is '^]'. sss HTTP/1.1 400 Bad Request Server: nginx Date: Mon, 26 Jun 2023 02:50:50 GMT Content-Type: text/html
Author
Owner

@commandoccz commented on GitHub (Jun 26, 2023):

It doesn't matter, as long as the server_addr supports domain name access and the format server_addr = xxx.com/xxx/ is correct, the rest is a network problem. I will troubleshoot step by step and then share the results.

<!-- gh-comment-id:1606544349 --> @commandoccz commented on GitHub (Jun 26, 2023): It doesn't matter, as long as the server_addr supports domain name access and the format **server_addr = xxx.com/xxx/** is correct, the rest is a network problem. I will troubleshoot step by step and then share the results.
Author
Owner

@commandoccz commented on GitHub (Jun 26, 2023):

nginx reverse_proxy conf:

#PROXY-START/
proxy_set_header Sec-WebSocket-Extensions $http_sec_websocket_extensions;
proxy_set_header Sec-WebSocket-Key $http_sec_websocket_key;
proxy_set_header Sec-WebSocket-Version $http_sec_websocket_version;

location /
{
proxy_pass http://localhost:7000;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_redirect off;
client_max_body_size 0;
proxy_ssl_verify off;
proxy_http_version 1.1;

proxy_set_header Upgrade $http_upgrade; 
proxy_set_header Connection "upgrade";

proxy_read_timeout 86400;
proxy_connect_timeout 86400;
proxy_cache off;
proxy_send_timeout 86400;
proxy_buffering off;

}
#PROXY-END/

nginx logfile:
221.234.213.176 - - - - - [26/Jun/2023:12:07:53 +0800] "GET / HTTP/2.0" 502 502"-" "curl/7.68.0" "-"
221.234.213.176 - - - - - [26/Jun/2023:12:08:48 +0800] "GET /~!frp HTTP/1.1" 302 -"-" "-" "-"
221.234.213.176 - - - - - [26/Jun/2023:12:14:30 +0800] "GET /~!frp HTTP/1.1" 302 -"-" "-" "-"
221.234.213.176 - - - - - [26/Jun/2023:12:21:19 +0800] "GET /~!frp HTTP/1.1" 302 -"-" "-" "-"
221.234.213.176 - - - - - [26/Jun/2023:12:23:12 +0800] "GET /~!frp HTTP/1.1" 302 -"-" "-" "-"

<!-- gh-comment-id:1606584512 --> @commandoccz commented on GitHub (Jun 26, 2023): **nginx reverse_proxy conf:** #PROXY-START/ proxy_set_header Sec-WebSocket-Extensions $http_sec_websocket_extensions; proxy_set_header Sec-WebSocket-Key $http_sec_websocket_key; proxy_set_header Sec-WebSocket-Version $http_sec_websocket_version; location / { proxy_pass http://localhost:7000; proxy_set_header X-Real-IP $remote_addr; proxy_set_header REMOTE-HOST $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host; proxy_redirect off; client_max_body_size 0; proxy_ssl_verify off; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_read_timeout 86400; proxy_connect_timeout 86400; proxy_cache off; proxy_send_timeout 86400; proxy_buffering off; } #PROXY-END/ **nginx logfile:** `221.234.213.176 - - - - - [26/Jun/2023:12:07:53 +0800] "GET / HTTP/2.0" 502 502"-" "curl/7.68.0" "-"` `221.234.213.176 - - - - - [26/Jun/2023:12:08:48 +0800] "GET /~!frp HTTP/1.1" 302 -"-" "-" "-"` `221.234.213.176 - - - - - [26/Jun/2023:12:14:30 +0800] "GET /~!frp HTTP/1.1" 302 -"-" "-" "-"` `221.234.213.176 - - - - - [26/Jun/2023:12:21:19 +0800] "GET /~!frp HTTP/1.1" 302 -"-" "-" "-"` `221.234.213.176 - - - - - [26/Jun/2023:12:23:12 +0800] "GET /~!frp HTTP/1.1" 302 -"-" "-" "-"`
Author
Owner

@commandoccz commented on GitHub (Jun 26, 2023):

Browser access:https://frpsocket-original.engineer.online/~!frp
response:
“not websocket protocol”

<!-- gh-comment-id:1606596326 --> @commandoccz commented on GitHub (Jun 26, 2023): Browser access:https://frpsocket-original.engineer.online/~!frp response: “not websocket protocol”
Author
Owner

@commandoccz commented on GitHub (Jun 26, 2023):

I feel this is a Domain Fronting issue.
https://xz.aliyun.com/t/11460

<!-- gh-comment-id:1606695527 --> @commandoccz commented on GitHub (Jun 26, 2023): I feel this is a Domain Fronting issue. https://xz.aliyun.com/t/11460
Author
Owner

@xqzr commented on GitHub (Jun 27, 2023):

Try v0.50.0

<!-- gh-comment-id:1609578432 --> @xqzr commented on GitHub (Jun 27, 2023): Try v0.50.0
Author
Owner

@commandoccz commented on GitHub (Jul 5, 2023):

使用websocket在线调试工具,后台能收到请求,因为调试工具没有TLS所以被拒绝,使用frpc客户端连接,依然直接报错,服务器端无任何反应
image

image

<!-- gh-comment-id:1620987273 --> @commandoccz commented on GitHub (Jul 5, 2023): 使用websocket在线调试工具,后台能收到请求,因为调试工具没有TLS所以被拒绝,使用frpc客户端连接,依然直接报错,服务器端无任何反应 ![image](https://github.com/fatedier/frp/assets/76011848/416bf206-6baf-483f-9772-687b274345f5) ![image](https://github.com/fatedier/frp/assets/76011848/0a3655da-2892-4502-822b-c1358aa423bd)
Author
Owner

@github-actions[bot] commented on GitHub (Aug 5, 2023):

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

<!-- gh-comment-id:1666301256 --> @github-actions[bot] commented on GitHub (Aug 5, 2023): Issues go stale after 30d of inactivity. Stale issues rot after an additional 7d of inactivity and eventually close.
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#2793
No description provided.