[GH-ISSUE #6281] [Bug]: Subscription URL path in the frontend does not update after changing the custom subscription path in settings #4266

Closed
opened 2026-10-31 20:38:24 +07:00 by bsakaguchi · 2 comments
Owner

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

There are no backend error logs because this is a frontend display issue. The backend x-ui service runs normally and successfully handles requests to the new custom path if the URL is manually corrected.

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

  • I searched existing issues and this bug has not been reported.
  • I am running the latest released version of 3x-ui (or have verified the bug still exists on it).
  • This bug report is written in English.
  • I have redacted any sensitive data (tokens, real domains, client UUIDs).
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://<ip>:<port>/my_custom_path/<token> ### Actual behavior The generated subscription URL is stuck on the old path: http://<ip>:<port>/sub/<token> ### Relevant logs ```shell There are no backend error logs because this is a frontend display issue. The backend x-ui service runs normally and successfully handles requests to the new custom path if the URL is manually corrected. ``` ### 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 - [x] I searched [existing issues](../issues?q=is%3Aissue) and this bug has not been reported. - [x] I am running the latest released version of 3x-ui (or have verified the bug still exists on it). - [x] This bug report is written in English. - [x] I have redacted any sensitive data (tokens, real domains, client UUIDs).
bsakaguchi 2026-10-31 20:38:24 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@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 subPath on 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.

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.subURI is read from the defaults payload (frontend/src/pages/inbounds/useInbounds.ts:183-201), which comes from POST /panel/api/setting/defaultSettings.

The server side is correct

internal/web/service/setting.go:1467-1471 re-reads subPath from the database on every call:

subPath, _ := s.GetSubPath()
...
if subEnable && result["subURI"].(string) == "" {
    result["subURI"] = subURI + subPath
}

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:

// frontend/src/pages/inbounds/useInbounds.ts:169-173  (identical at frontend/src/hooks/useClients.ts:229-233)
const defaultsQuery = useQuery({
  queryKey: keys.settings.defaults(),
  queryFn: fetchDefaultSettings,
  staleTime: Infinity,
});

and the settings save invalidates only the other settings key:

// frontend/src/api/queries/useAllSettings.ts:79
queryClient.invalidateQueries({ queryKey: keys.settings.all() });

keys.settings.defaults() is never invalidated or re-set anywhere in frontend/src — a search for keys.settings returns only those two reads plus settings.all() and settings.factoryDefaults(). The query client is a single module-level instance (frontend/src/queryClient.ts:3) shared by every /panel route (frontend/src/routes.tsx:44 and :49), so with staleTime: Infinity the 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:2563 BuildURLs, 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:

  1. After a hard reload of the panel tab, does the copied link still show /sub/? If it now shows /my_custom_path/, the stale cache above is the whole story.
  2. If it still shows /sub/ after a hard reload, the cause is a different one: check Panel Settings → Subscription → Reverse Proxy URI (the subURI field). A non-empty subURI deliberately overrides subPath for the generated link and QR code (internal/web/service/setting.go:1470, internal/sub/service.go:2610-2611). Clearing it restores the subPath-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's onSuccess invalidates only keys.settings.all(), never keys.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 with staleTime: Infinity. Trigger: change subPath (or subDomain/subPort/subTitle) and reach Inbounds/Clients by client-side navigation instead of a full page load; the panel then renders the pre-save subURI. The keys.settings.defaults() cache key was introduced in cfe1b25c (2026-05-24, "feat(frontend): TanStack Query + React Router migration & in-panel API docs (#4541)") — git log -S "settings.defaults" -- frontend/src returns that commit only.
Already fixed: Still present on the default branch (checked at 1250fbb7); git diff v3.6.0..HEAD -- internal/web/service/setting.go shows no change to GetDefaultSettings, and the invalidation is still absent.
Duplicate of: None
Evidence: frontend/src/api/queries/useAllSettings.ts:79 queryClient.invalidateQueries({ queryKey: keys.settings.all() }); · frontend/src/pages/inbounds/useInbounds.ts:172 staleTime: Infinity, · frontend/src/hooks/useClients.ts:232 staleTime: Infinity, · frontend/src/queryClient.ts:3 single module-level new 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 recomputes subURI from subPath per request) · internal/web/controller/setting.go:108-115 (getDefaultSettings has no caching) · no test in frontend/src/test/use-all-settings.test.tsx pins 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/, the subURI field 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), invalidate keys.settings.root() — or keys.settings.defaults() alongside keys.settings.all() — so the derived subscription URLs refetch after a settings save.

This reply was generated automatically; a maintainer may follow up.

<!-- gh-comment-id:5370949782 --> @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 `subPath` on 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.subURI` is read from the `defaults` payload (`frontend/src/pages/inbounds/useInbounds.ts:183-201`), which comes from `POST /panel/api/setting/defaultSettings`. ### The server side is correct `internal/web/service/setting.go:1467-1471` re-reads `subPath` from the database on every call: ```go subPath, _ := s.GetSubPath() ... if subEnable && result["subURI"].(string) == "" { result["subURI"] = subURI + subPath } ``` 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: ```ts // frontend/src/pages/inbounds/useInbounds.ts:169-173 (identical at frontend/src/hooks/useClients.ts:229-233) const defaultsQuery = useQuery({ queryKey: keys.settings.defaults(), queryFn: fetchDefaultSettings, staleTime: Infinity, }); ``` and the settings save invalidates only the *other* settings key: ```ts // frontend/src/api/queries/useAllSettings.ts:79 queryClient.invalidateQueries({ queryKey: keys.settings.all() }); ``` `keys.settings.defaults()` is never invalidated or re-set anywhere in `frontend/src` — a search for `keys.settings` returns only those two reads plus `settings.all()` and `settings.factoryDefaults()`. The query client is a single module-level instance (`frontend/src/queryClient.ts:3`) shared by every `/panel` route (`frontend/src/routes.tsx:44` and `:49`), so with `staleTime: Infinity` the 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:2563` `BuildURLs`, `internal/web/service/tgbot/tgbot_client.go:151-208`). ### Workaround right now Hard-reload the panel tab (<kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>R</kbd>, or <kbd>Cmd</kbd>+<kbd>Shift</kbd>+<kbd>R</kbd>), 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: 1. After a hard reload of the panel tab, does the copied link still show `/sub/`? If it now shows `/my_custom_path/`, the stale cache above is the whole story. 2. If it **still** shows `/sub/` after a hard reload, the cause is a different one: check **Panel Settings → Subscription → Reverse Proxy URI** (the `subURI` field). A non-empty `subURI` deliberately overrides `subPath` for the generated link and QR code (`internal/web/service/setting.go:1470`, `internal/sub/service.go:2610-2611`). Clearing it restores the `subPath`-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's `onSuccess` invalidates only `keys.settings.all()`, never `keys.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 with `staleTime: Infinity`. Trigger: change `subPath` (or `subDomain`/`subPort`/`subTitle`) and reach Inbounds/Clients by client-side navigation instead of a full page load; the panel then renders the pre-save `subURI`. The `keys.settings.defaults()` cache key was introduced in cfe1b25c (2026-05-24, "feat(frontend): TanStack Query + React Router migration & in-panel API docs (#4541)") — `git log -S "settings.defaults" -- frontend/src` returns that commit only. Already fixed: Still present on the default branch (checked at 1250fbb7); `git diff v3.6.0..HEAD -- internal/web/service/setting.go` shows no change to `GetDefaultSettings`, and the invalidation is still absent. Duplicate of: None Evidence: `frontend/src/api/queries/useAllSettings.ts:79` `queryClient.invalidateQueries({ queryKey: keys.settings.all() });` · `frontend/src/pages/inbounds/useInbounds.ts:172` `staleTime: Infinity,` · `frontend/src/hooks/useClients.ts:232` `staleTime: Infinity,` · `frontend/src/queryClient.ts:3` single module-level `new 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 recomputes `subURI` from `subPath` per request) · `internal/web/controller/setting.go:108-115` (`getDefaultSettings` has no caching) · no test in `frontend/src/test/use-all-settings.test.tsx` pins 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/`, the `subURI` field 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`), invalidate `keys.settings.root()` — or `keys.settings.defaults()` alongside `keys.settings.all()` — so the derived subscription URLs refetch after a settings save. *This reply was generated automatically; a maintainer may follow up.* <!-- claude-issue:analyst -->
Author
Owner

@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.

<!-- gh-comment-id:5371080401 --> @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.
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
MHSanaei/3x-ui#4266
No description provided.