Skip to content

feat(server/gui): add Unix Domain Socket and BaseUrl support for FnOS & reverse proxies#1885

Merged
MarksonHon merged 1 commit into
v2rayA:mainfrom
yuexps:main
Jun 28, 2026
Merged

feat(server/gui): add Unix Domain Socket and BaseUrl support for FnOS & reverse proxies#1885
MarksonHon merged 1 commit into
v2rayA:mainfrom
yuexps:main

Conversation

@yuexps

@yuexps yuexps commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

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 Found issues 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:

    • Added V2RAYA_SOCKET/--socket and V2RAYA_BASEURL/--baseurl options.
    • Mounted routes (auth, noAuth, and ServeGUI) under the BaseUrl group.
    • Enabled net.Listen("unix", ...) and chmod 0777 on the socket file.
    • Adapted registerEmbeddedRoute to dynamically strip the BasePath prefix from static assets.
  • Frontend GUI:

    • Adjusted connectWsMessage and backendPort.js to dynamically detect and use the subpath prefix for API & WS connections.
    • Relaxed the input verification pattern in server address settings to support relative path prefixes.
      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 at 0.0.0.0:2017 and 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)
      Default TCP Mode Verification

    • Test 2: Unix Domain Socket + BaseUrl Subpath Mode Verification (100% Normal)
      UDS and BaseUrl Mode Verification - Page Rendering
      UDS and BaseUrl Mode Verification - WebSocket Logs

@MarksonHon MarksonHon merged commit 4e36649 into v2rayA:main Jun 28, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants