mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #6281] [Bug]: Subscription URL path in the frontend does not update after changing the custom subscription path in settings #4266
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#4266
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @SakikoTogawa0214 on GitHub (Aug 21, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6281
Describe the bug
After modifying the custom subscription path in Panel Settings, the subscription URL generated by the frontend UI (via the "Copy Subscription" button or QR code) does not update. It continues to display the default/old path (e.g., /sub/).
However, the backend routing is actually updated successfully—if I manually replace /sub/ with the new custom path in the copied URL, clients can fetch the subscription perfectly. This is purely a frontend UI bug where it fails to use the new path variable to assemble the URL.
How to reproduce the problem
Go to Panel Settings.
Find the Subscription Settings and change the "Subscription Path" from the default /sub/ to a custom path (e.g., /my_custom_path/).
Save the settings and click “Restart the panel service“.
Go to the Inbounds/Node list.
Click the "Copy Subscription" button or view the QR code for any node.
Check the URL copied to your clipboard. It still shows the old /sub/ path instead of /my_custom_path/.
Expected behavior
The generated subscription URL should fetch the newly saved variable and reflect the custom path: http://:/my_custom_path/
Actual behavior
The generated subscription URL is stuck on the old path: http://:/sub/
Relevant logs
Screenshots
No response
3x-ui version
v3.6.0
Xray-core version
26.7.28
How did you install 3x-ui?
install.sh script
Operating system
Debian 12
Which parts of the panel are affected?
No response
Browser (only if it is a UI bug)
Chrome 151
Is the panel behind a reverse proxy or CDN?
No — direct access
Before submitting
@github-actions[bot] commented on GitHub (Aug 21, 2026):
Confirmed, and your diagnosis is right: this is a frontend bug. The backend recomputes the subscription base URL from
subPathon every request; the panel UI caches that value once per browser session and nothing invalidates it when you save settings, so the "Copy Subscription" button and the QR code keep emitting the pre-change/sub/link until the tab is fully reloaded.Where the link is built
Every subscription link in the panel is assembled in the browser as
subURI + subId:frontend/src/pages/inbounds/InboundsPage.tsx:369—subLinks.push(subSettings.subURI + c.subId);frontend/src/pages/inbounds/qr/QrCodeModal.tsx:119—nextSub = (subSettings.subURI || '') + subId;frontend/src/pages/inbounds/info/InboundInfoModal.tsx:172—setSubLink((subSettings?.subURI || '') + clientSet.subId);subSettings.subURIis read from thedefaultspayload (frontend/src/pages/inbounds/useInbounds.ts:183-201), which comes fromPOST /panel/api/setting/defaultSettings.The server side is correct
internal/web/service/setting.go:1467-1471re-readssubPathfrom the database on every call:So the endpoint returns
http://<ip>:<port>/my_custom_path/immediately after the save — which matches what you observed, that the backend routing is fine.The stale cache
The defaults query is pinned forever:
and the settings save invalidates only the other settings key:
keys.settings.defaults()is never invalidated or re-set anywhere infrontend/src— a search forkeys.settingsreturns only those two reads plussettings.all()andsettings.factoryDefaults(). The query client is a single module-level instance (frontend/src/queryClient.ts:3) shared by every/panelroute (frontend/src/routes.tsx:44and:49), so withstaleTime: Infinitythe entry survives client-side navigation from Settings to Inbounds and is only dropped by a full page load.Server-rendered paths are unaffected, which is consistent with your report: the subscription page itself and the Telegram bot build the URL in Go (
internal/sub/service.go:2563BuildURLs,internal/web/service/tgbot/tgbot_client.go:151-208).Workaround right now
Hard-reload the panel tab (Ctrl+Shift+R, or Cmd+Shift+R), then copy the link again.
One thing I could not settle
Your step 3 says you clicked Restart the panel service, which normally forces exactly that full reload (
frontend/src/pages/settings/SettingsPage.tsx:148→window.location.replace(rebuildUrlAfterRestart())). That reload is skipped when the restart request does not come back successful —SettingsPage.tsx:146:if (!msg?.success) return;. So:/sub/? If it now shows/my_custom_path/, the stale cache above is the whole story./sub/after a hard reload, the cause is a different one: check Panel Settings → Subscription → Reverse Proxy URI (thesubURIfield). A non-emptysubURIdeliberately overridessubPathfor the generated link and QR code (internal/web/service/setting.go:1470,internal/sub/service.go:2610-2611). Clearing it restores thesubPath-derived URL. Please paste the exact copied URL as text rather than a screenshot.Verdict: Confirmed bug
Severity: Medium
Confidence: Medium
Root cause:
frontend/src/api/queries/useAllSettings.ts:79— the settings save mutation'sonSuccessinvalidates onlykeys.settings.all(), neverkeys.settings.defaults(), while both consumers of that key (frontend/src/pages/inbounds/useInbounds.ts:169-173,frontend/src/hooks/useClients.ts:229-233) pin it withstaleTime: Infinity. Trigger: changesubPath(orsubDomain/subPort/subTitle) and reach Inbounds/Clients by client-side navigation instead of a full page load; the panel then renders the pre-savesubURI. Thekeys.settings.defaults()cache key was introduced incfe1b25c(2026-05-24, "feat(frontend): TanStack Query + React Router migration & in-panel API docs (#4541)") —git log -S "settings.defaults" -- frontend/srcreturns that commit only.Already fixed: Still present on the default branch (checked at
1250fbb7);git diff v3.6.0..HEAD -- internal/web/service/setting.goshows no change toGetDefaultSettings, and the invalidation is still absent.Duplicate of: None
Evidence:
frontend/src/api/queries/useAllSettings.ts:79queryClient.invalidateQueries({ queryKey: keys.settings.all() });·frontend/src/pages/inbounds/useInbounds.ts:172staleTime: Infinity,·frontend/src/hooks/useClients.ts:232staleTime: Infinity,·frontend/src/queryClient.ts:3single module-levelnew QueryClient({...})·frontend/src/pages/inbounds/InboundsPage.tsx:369,frontend/src/pages/inbounds/qr/QrCodeModal.tsx:119,frontend/src/pages/inbounds/info/InboundInfoModal.tsx:172(link =subURI + subId) ·internal/web/service/setting.go:1467-1471(server recomputessubURIfromsubPathper request) ·internal/web/controller/setting.go:108-115(getDefaultSettingshas no caching) · no test infrontend/src/test/use-all-settings.test.tsxpins the defaults invalidation.Not determined: Whether your specific run went through a full page reload. The single check that settles it: after a hard reload, is the copied link
/sub/or/my_custom_path/? If it is still/sub/, thesubURIfield is set and this issue is a second, unrelated cause.Suggested fix: In the save mutation's
onSuccess(frontend/src/api/queries/useAllSettings.ts:76-80), invalidatekeys.settings.root()— orkeys.settings.defaults()alongsidekeys.settings.all()— so the derived subscription URLs refetch after a settings save.This reply was generated automatically; a maintainer may follow up.
@SakikoTogawa0214 commented on GitHub (Aug 21, 2026):
After modifying the custom subscription path in Panel Settings and clicking "Save" then "Restart Panel", the backend service updates and restarts correctly.
However, the frontend does not automatically flush the browser cache or refresh the local state. Because the subscription link generation relies on the data already cached in the browser, it continues to display the old path (e.g., /sub/) instead of the newly saved one. The correct link is only displayed after manually performing a hard refresh (F5) of the page.
This is purely a frontend state/cache issue where the UI fails to reload the updated configuration after a panel restart.