feat(server/gui): add Unix Domain Socket and BaseUrl support for FnOS & reverse proxies#1885
Merged
Conversation
… & reverse proxies
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.
This PR adds Unix Domain Socket (UDS) listening and BaseUrl subpath support to v2rayA, primarily adapting for FnOS gateway and similar reverse-proxy environments.
Why this is needed:
UDS Support: Avoids exposing TCP ports locally, allowing safer and more efficient Unix socket communication with local gateways.
BaseUrl Support: Fixes
404 Not Foundissues for web static assets (/static/*) and WebSockets (/api/message) when v2rayA is hosted under a reverse-proxy subpath (e.g.https://nas.local/v2raya-sub/).Key Changes:
Go Backend:
V2RAYA_SOCKET/--socketandV2RAYA_BASEURL/--baseurloptions.auth,noAuth, andServeGUI) under theBaseUrlgroup.net.Listen("unix", ...)andchmod 0777on the socket file.registerEmbeddedRouteto dynamically strip theBasePathprefix from static assets.Frontend GUI:
connectWsMessageandbackendPort.jsto dynamically detect and use the subpath prefix for API & WS connections.Compatibility Guarantee & Test Proofs:
Strict Backward Compatibility:
We have conducted comprehensive regression testing on the default startup scenario. When running without the new UDS (
--socket) or BaseUrl (--baseurl) options, v2rayA behaves 100% identically as before—strictly keeping TCP listening at0.0.0.0:2017and root routing at/. There is absolutely zero deviation in API endpoints or WebSocket handshakes under default configurations, guaranteeing a safe upgrade paths with no regressions.Test Screenshots:
Test 1: Default TCP Mode Verification (100% Normal)

Test 2: Unix Domain Socket + BaseUrl Subpath Mode Verification (100% Normal)

