[GH-ISSUE #5278] [Feature Request] 支持修改 WebSocket 路径 #4076

Closed
opened 2026-05-05 14:34:54 -06:00 by gitea-mirror · 0 comments
Owner

Originally created by @xrgzs on GitHub (Apr 4, 2026).
Original GitHub issue: https://github.com/fatedier/frp/issues/5278

Describe the feature request

当前 WebSocket 路径作为常量写死,为了让 frpc 能够正常连接,必须写死 /~!frp,因此可以被路径扫描识别,希望支持修改。

d667be7a0a/pkg/util/net/websocket.go (L14-L16)

Describe alternatives you've considered

增加一个 WebSocketOptions 配置:

# frps.toml
bindPort = 7000
transport.ws.path = "/another/path/to/frp"
# nginx-wss.conf
server {
    listen 443 ssl;
    server_name your-server.com;
    ssl_certificate /path/to/cert.pem;
    ssl_certificate_key /path/to/key.pem;

    location / {
        return 404;
    }

    location /another/path/to/frp {
        proxy_pass http://127.0.0.1:7000; # frps 的 bindPort
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }
}
# frpc.toml
serverAddr = "example.com"
serverPort = 443

transport.protocol = "wss"
transport.ws.path = "/another/path/to/frp"

Affected area

  • Docs
  • Installation
  • Performance and Scalability
  • Security
  • User Experience
  • Test and Release
  • Developer Infrastructure
  • Client Plugin
  • Server Plugin
  • Extensions
  • Others
Originally created by @xrgzs on GitHub (Apr 4, 2026). Original GitHub issue: https://github.com/fatedier/frp/issues/5278 ### Describe the feature request 当前 WebSocket 路径作为常量写死,为了让 frpc 能够正常连接,必须写死 `/~!frp`,因此可以被路径扫描识别,希望支持修改。 https://github.com/fatedier/frp/blob/d667be7a0a4c6fb62185461f5ebeeac3ede1cb30/pkg/util/net/websocket.go#L14-L16 ### Describe alternatives you've considered 增加一个 WebSocketOptions 配置: ```toml # frps.toml bindPort = 7000 transport.ws.path = "/another/path/to/frp" ``` ```nginx # nginx-wss.conf server { listen 443 ssl; server_name your-server.com; ssl_certificate /path/to/cert.pem; ssl_certificate_key /path/to/key.pem; location / { return 404; } location /another/path/to/frp { proxy_pass http://127.0.0.1:7000; # frps 的 bindPort proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } } ``` ```toml # frpc.toml serverAddr = "example.com" serverPort = 443 transport.protocol = "wss" transport.ws.path = "/another/path/to/frp" ``` ### Affected area - [x] Docs - [ ] Installation - [x] Performance and Scalability - [x] Security - [ ] User Experience - [ ] Test and Release - [ ] Developer Infrastructure - [ ] Client Plugin - [ ] Server Plugin - [ ] Extensions - [ ] Others
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#4076
No description provided.