feat(client): add transport.websocketPath option for custom websocket handshake path#5389
Open
6rock wants to merge 1 commit into
Open
feat(client): add transport.websocketPath option for custom websocket handshake path#53896rock wants to merge 1 commit into
6rock wants to merge 1 commit into
Conversation
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (9 files)
Reviewed by gpt-5.5-20260423 · Input: 73K · Output: 5.1K · Cached: 338.2K |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WHY
Closes #5388
When
transport.protocoliswebsocketorwss, frpc always performs the websocket handshake on a hard-coded path/~!frp(pkg/util/net/websocket.go), with no way to configure it. This makes it hard to place frps behind a reverse proxy (e.g. nginx) that routes traffic by path — for example sharing port 443 with other services, or running multiple frps instances behind a single entrypoint.This PR adds a client-side
transport.websocketPathoption:/~!frpwhen empty — fully backward compatible, existing configs are unaffected./), the client uses it for the websocket/wss handshake./~!frp.Example:
nginx then matches
location /frp, rewrites it to/~!frp, and proxies to frps.Changes
WebsocketPathto the v1ClientTransportConfigand the legacy client config (with legacy→v1 conversion).DialHookWebsocket, defaulting to/~!frpwhen empty (consistent with the existing empty-parameter defaulting in that function)./(both v1 and legacy validation).frpc_full_example.toml, the legacy ini example, andRelease.md.The change is client-side only;
go build/go vetandpkg/config/...tests pass.